So I was reading Ingo’s blog to create a custom task form for my workflow, if you need to create custom ASPX form for your custom task content-type you can go check his blog.
Basically my problem was, how to fill the custom fields inside CreateTaskByContentType activity? there’s ExtendedProperties but putting the field name on ExtendedProperties seems does not pass anything to the newly created Task.
This is my previous code
createTaskProperties.Title = "New Task"; createTaskProperties.PercentComplete = 0; createTaskProperties.ExtendedProperties["CustomField"] = "Something";
After googling for a bit, I found a solution (sorry I forgot the URL since I *accidentally* clear my history). Basically we are still using ExtendedProperties but we can’t use the custom field name, we have to use GUID of the field.
This is the fixed code
createTaskProperties.Title = "New Task"; createTaskProperties.PercentComplete = 0; Guid custField = workflowProperties.TaskList.Fields["CustomField"].Id; createTaskProperties.ExtendedProperties[custField] = "Something";
Voila! the custom field in our custom task will be populated on CreateTask Activity.
Happy meddling with Workflow 🙂