Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Workflow using custom InfoPath Task Form can't access Extended Properties from ItemMetaData.xml

Answered Workflow using custom InfoPath Task Form can't access Extended Properties from ItemMetaData.xml

  • Friday, April 13, 2012 11:01 PM
     
      Has Code

    I have a custom task form working in InfoPath and am able to set values using the ItemMetaData.xml file. However trying to access Values from the AfterProperties of the task is returning an empty string.

    So my steps are:

    I add the extended property when creating the task:

     private void CreateApprovalTask_MethodInvoking(object sender, EventArgs e)
            {
                approvalTaskId = Guid.NewGuid();
                approvalTaskProperties.TaskType = 0;
                approvalTaskProperties.SendEmailNotification = true;
                approvalTaskProperties.ExtendedProperties.Add("Technical_Input", "Test Value");

    Add the property to the ItemMetadata.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <z:row xmlns:z="#RowsetSchema"
      ows_Technical_Input="" />
    

    Test it in the Form, it works just fine:

    But when I debug and access the value from the Extended After Property, i'm getting an empty string instead of the user's input:

            private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
            {
                string TechnicalInput = 
                    this.approvalTaskAfterProperties.ExtendedProperties["Technical_Input"].ToString();

    Has anyone ever experienced this?

All Replies

  • Tuesday, April 17, 2012 2:47 AM
    Moderator
     
     

    Hi Omar,

    For the ExtendedProperties, the hash table contains a GUID and a value, use the name of the field will not work, please try to get the ID of the field first, then get the value using ExtentedProperties[fieldID].

    System.Guid fieldID = workflowProperties.TaskList.Fields[“fieldname”].Id;

    Thanks,
    Qiao


    Qiao Wei

    TechNet Community Support

  • Tuesday, April 17, 2012 1:20 PM
     
     Answered

    Thanks Qiao. That didn't seem to work in the OnTaskChanging Event.

    I Eventually found the problem: SharePoint wouldn't write back to the ItemMetaData Fields unless they were in the Root of the InfoPath Form. Fields in Folders don't seem to bind.

  • Thursday, April 26, 2012 9:42 PM
     
     
    Thanks Omar. I was having the same issue and this solved it.

    C#, Sharepoint