Friday, March 14, 2014

AgilePoint Infopath integration: XML content as parameter

If you ever need to pass the entire XML document/body of an InfoPath as a parameter in AgilePoint, use this:
$//
Just like any other attributes that you reference ($AttrName)

For example, when you are making use of a web service that accepts an XML document as a parameter.

When you are using managed C# code, you can do this instead:



pi being the WFProcessInstance
WFCustomAttributes ds = pi.WFApi.GetCustomAttrs( pi.WorkObjectID, true );
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml(ds["//"] as string);

XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(xmlDoc.NameTable);
nameSpaceManager.AddNamespace("my",xmlDoc.DocumentElement.NamespaceURI);

// Retrieve values based on xpath for manipulation
string xpath = "/my:myFields/my:Approvers[my:Dept='Finance']";
string value = xmlDoc.DocumentElement.SelectSingleNode(xpath, nameSpaceManager).InnerText;
Related Posts Plugin for WordPress, Blogger...