[英]Lookup column in SharePoint Task List of a Visual Studio Workflow
I have a State Machine SharePoint 2010 Workflow. 我有一个状态机SharePoint 2010工作流。 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. 以下代码段来自CreateApproverTaskWithCT方法。
//**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. 其中agencyItem是对应查找列的SPListItem。 and GetField method return the guid of the custom field.
和GetField方法返回自定义字段的GUID。
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());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.