If the defined variable’s internal storage is of type, following code has to be included while invoking the workflow.

  issue
If the defined variable’s internal storage is of type, following code has to be included while invoking the workflow.

solution
NAMESPACE USED   Workflow.NET Workflow.NET.Engine Workflow.NET.Interfaces Workflow.NET.Web.Designer Workflow.NET.Engine.Interfaces Skelta.SharePoint Skelta.SharePoint.ObjectsCore Skelta.Repository.List Skelta.Repository Skelta.Forms.Core.Controls Skelta.Forms Skelta.InfoPath Skelta.SharePoint.Enterprise.XmlStorageType   Mapping the value of Xml Variable   If the defined variable├óΓé¼Γäós internal storage is of type, following code has to be included while invoking the workflow.   Workflow.NET.VariablesCollection varCol = new Workflow.NET.VariablesCollection();   string xstring = "JohnDevelopment";   // EmployeeXmlVariable is the name of the XmlVariable defined in the workflow varCol.Add("EmployeeXmlVariable", "string", xstring);   //Initializes a new instance of the Client class with the specified application and workflow names Client objSKClient = new Client("MyRepository","MyWorkflow");   //xmlData can be any Content data that is being passed to the workflow string xmlData = "John";     //Executes a workflow with a version number, user id, custom XML content and variable collection object; xmlData is the content data objSKClient.Execute(1,"activedirectory::Bob",xmlData,varCol);   // If the defined Xml variable├óΓé¼Γäós internal storage is of type: Content , XmlVariable will take the data from the passed content provided the schema of the Content variable be the same as passed from here.      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 defined in the workflow.     //_WorkFlowContext is the runtime context object Workflow.NET.Engine.Context _WorkFlowContext; int executionId = 123;   //Gets the workflow Context for the specified execution id where executionId is the Execution Id (type int) of the workflow. _WorkFlowContext = Workflow.NET.Engine.Context.GetContext(executionId, "MyRepository");     // Updates the value (XML string) of xmlvariable using the RawXml property. //Here EmployeeXmlVariable is the Xml Variable defined in the workflow. _WorkFlowContext.XmlVariables["EmployeeXmlVariable"].RawXml = "KevinTestingJohnTesting";   //We can also loop through the list of Xml Variables, verify if the variable exists and then update the Xml variable using the //following code //foreach (Workflow.NET.XmlVariable xVariable in _WorkFlowContext.XmlVariables.Values) //{   //Getting the Xml Variable // if(xVaraiable.Name == "EmployeeXmlVariable")   // updating the value (XML string) of xmlvariable using the RawXml property //((Workflow.NET.XmlStorageType.XmlDocument)

Did you find this article helpful?