Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am developing a workflow. I have extended the Workflow Task content type with the Comments field using SharePoint UI. I need to set some value for this field in my code when editing the task, but it stays empty. Here's my code:

private void SetTaskProperties(string comment)
{
    Hashtable taskProperties;

    taskProperties = new Hashtable();
    taskProperties.Add(SPBuiltInFieldId.Completed, true);
    taskProperties.Add(SPBuiltInFieldId.TaskStatus, completed);
    taskProperties.Add(SPBuiltInFieldId.PercentComplete, 1.0);
    taskProperties.Add(SPBuiltInFieldId.Comments, comment);
    SPWorkflowTask.AlterTask(this.task, taskProperties, false);
}

Should I be using something else than SPBuiltInFieldId.Comments? I am getting the same result when updating the task directly, instead of using the Hashtable in the code above.

share|improve this question
    
I can't check the code but I'm sure when I did this I used the alternative method of taskProperties["Comments"] = comment;, or something similar (At home can't check). Have you tried this? –  Hugh Wood Nov 27 '12 at 0:18
    
I did and it doesn't work. I tried with SPBuiltInFieldId.Comments and with SPBuiltInFieldId.Comment. Did you know that there are 3 fields in SharePoint that are named Comments? This is nuts! –  Boris Nov 27 '12 at 15:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.