Skip to main content

As of this writing the Simple Data Mapper wizard event is not yet available for BlackPearl.  For now, within a default server code event it is relatively easy to pull data from your XML fields into your process datafields.  Use the following code, customizing your SchemaName for the text SchemaName below.  You would need an XML field called Notes and a Process Datafield called Notes for this to work.

          //substitute your SchemaName here (K2ObjectBrowser>DataTab>XMLFields>the one below "activities" is your SchemaName)
          string XMLString = K2.ProcessInstance.XmlFieldse"SchemaName"].Value;


          //the double slash "//" in the XPATH makes the xmlhelper search for the field name, if you had more than one Notes fields you would need a more concise XPATH
          K2.ProcessInstance.DataFieldsÂ"Notes"].Value = SourceCode.Workflow.Common.XmlHelper.GetXPathValue(XMLString, "//my:Notes");


Hope this helps,


Joseph

It is worth noting that when an activity contains an Infopath Client Event, the XML is reintegrated into the process at the end of the activity.  This means that if you insert server code events like the example above, after the Infopath Client Event and before the end of the activity, the changes you make to the XML will be lost.  The best way to accomplish this is to place any server code event in the activities following your Infopath Client Event Activity.
It is worth noting that when an activity contains an Infopath Client Event, the XML is reintegrated into the process at the end of the activity.  This means that if you insert server code events like the example above, after the Infopath Client Event and before the end of the activity, the changes you make to the XML will be lost.  The best way to accomplish this is to place any server code event in the activities following your Infopath Client Event Activity.

I understand your example but I am unsure of how I would find out the "SchemaName". Could you provide a little help in this area of your example?


Thank you,


 


Matt


 


In Joseph's example, "SchemaName" is the name of the XML data field.  It is the name you give the data field when you create it.

Reply