I have a State Machine SharePoint 2010 Workflow. The task is created by content type. I wanted to add a lookup column in task list. I was able to successfully add values to other custom field into the task list but having problem when I try add values to the lookup column of the task list.
Following code snippets were from CreateApproverTaskWithCT method.
//**I amable to add values to custom columns like this
createApproverTaskWithCT_TaskProperties1.ExtendedProperties[GetField("StatusReview")] = "Pending";
//**I am not able to add values to lookup column
createApproverTaskWithCT_TaskProperties1.ExtendedProperties[GetField("AgencyNameLookup")] = new SPFieldLookupValue(agencyItem.ID, agencyItem["Agency Legal Name"].ToString());
where agencyItem is a SPListItem for the corresponding lookup column. and GetField method return the guid of the custom field.
private Guid GetField(string field_name) { Guid statusFieldId = workflowProperties.TaskList.Fields.GetFieldByInternalName(field_name).Id; return statusFieldId; }
Any suggestions would be highly appreciated.
我可以通过以下方法插入值以在任务列表中查找字段:
createApproverTaskWithCT_TaskProperties1.ExtendedProperties[GetField("AgencyNameLookup")] = String.Format(agencyItem.ID + ";#" + agencyItem["Agency Legal Name"].ToString());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.