3

In a workflow task, in custom edit form, i use CompositeField to render relevant fields current task item and for workflow item by setting a different context for CompositeField.

However if i put Task List item field first, it will render only task list item fields, leaving workflow item fields with some example value like ["Title" field value]

I investigated that its actually FormField control that CompositeField uses to display value is guilty.

Below you can see code i use to render the workflow item field and output it provides.

<SharePoint:CompositeField ID="TitleField" FieldName="Title" ControlMode="Display" runat="server" />


SPContext workflowItemContext = SPContext.GetContext(HttpContext.Current, this.WorkflowItem.ID, this.WorkflowItem.ParentList.ID, SPContext.Current.Web);
this.TitleField.ItemContext = workflowItemContext;

TitleField, rendered in display mode

Note that before rendering this control, i have other CompositeFields that render value correctly for task item. The value says something like: ["Title" field value]

But if i change ControlMode="Edit", it displays field value. TitleField, rendered in edit mode

What's the problem and how to get CompositeField to display correct value not some example value at in Display mode along with other CompositeFields with different context?

Note: I use SharePoint 2007

1 Answer 1

2

I have exactly same problem in sharepoint foundation 2010. So far i think it is bug in sharepoint. FormFields some how changes listid and itemid in contextes of other controls when Formfield is rendered. Note that this happens only when it rendered, so if you put two formfields on one page but one of them have visible attribute=false, other formfield will be shown correctly. I use multiview to get round this problem: i put field from different elements on different view and navigate between them with asp menu. So technically i have all fields on one page, but on differnet 'tabs'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.