XML Variable Usage in AX Workflow Manager

Issue:
Below describes the XML variable usage in AX Workflow Manager

Solution: Mapping the value of Xml Variable   If the defined Xml variable├óΓé¼Γäós internal storage is of type Variable, following code has to be included while invoking the workflow.       Workflow.NET.VariablesCollection varCol = newWorkflow.NET.VariablesCollection();   string xstring = "JohnDevelopment";    varCol.Add("Employeevariable", "string", xstring); // Employeevariable is the name of the xmlvariable defined in designer   objSKClient.Execute(1,xmlData,varCol);   //XmlData is the content data // If the defined Xml variable├óΓé¼Γäós internal storage is of type: content , Xmlvariable will take the data from the passed content               Updating XML variables   The XML variables defined for a workflow can be updated by getting the current context of the workitem and referring the XML variables, _WorkFlowContext.XmlVariables.Values will give the XML variables configured.       // updating the value (XML string) of xmlvariable foreach (Workflow.NET.XmlVariable xVaraiable in _WorkFlowContext.XmlVariables.Values)  {      //Setting the XML string using the RawXml property      ((Workflow.NET.XmlStorageType.XmlDocument)xVaraiable.StorageHandler).RawXml =                                "KevinTesting JohnTesting";   } //_WorkFlowContext is the runtime context object     Updating the value of the node   The node name of the XML string can be updated by referring to that node├óΓé¼Γäós parameters the following code illustrates updating the node value       //Updating the value of the node  object[] Submittedvalues  = newobject[1];   //object[1] referes to the node Name  Submittedvalues[0] = "Ken";  _WorkFlowContext.XmlVariables["Test"].SetNodeValue("//Employee/Name", Submittedvalues); //Test is the name of the XML variable defined in the workflow //_WorkFlowContext is the runtime context object         Updating the Root node   To update the root node the XML nodelist has to be build and the following code has to be executed.         //Updating Root node   //XMl string,using which the root node of the xmlvariable has to be updated string xstring = "JohnDevelopment";   //Creating the XML nodelist XmlDocument xdoc = newXmlDocument(); xdoc.LoadXml(xstring); XmlNodeList xnodelist = xdoc.SelectNodes("//Employees/Employee"); //Defining the object array  object[] submittedvalues = newobject[xnodelist.Count]; int i = 0;   //Fill the object array foreach (XmlNode xnode in xnodelist) {    submittedvalues[i] = xnode;     i = i + 1;  }   //Set the updated value to the root node,├óΓé¼∩å¥Test├óΓé¼∩奠 is the name of the XMLvariable which is defined in the workflow //Updates the root node of the Test variable with the

Did you find this article helpful?