Upgrade the Update XML action

  • 12 December 2022
  • 0 replies
  • 77 views

Userlevel 3
Badge +11

Scenario

How to upgrade a Nintex for Office 365 workflow to Nintex Workflow Cloud that uses the Update XML action.

 

After Update

  • You will have to completely reconfigure the action for all usage cases.
  • The property, Content, becomes XML Source. The property can be populated with XML formatted text or with variables that contain XML.
  • If you use the Content property to store XML data text inside your workflow, you will need to copy your XML Source content over from your Office 365 workflow.
  • If you use the property, Existing SharePoint content, you will need to reconfigure how your workflow locates the SharePoint XML data you want to query.
  • If you use the property, Current item, from inside a workflow associated with a document library, you will need to reconfigure how your workflow locates the XML data you want to query.

 

Differences

  • The property, Existing SharePoint content, is not supported in Nintex Workflow Cloud.
  • The property, Current item, is not supported in Nintex Workflow Cloud.
  • Use the action, Call a SharePoint web service, to get an XML file from a document library to satisfy the above two differences.
  • Use the action, Call a web service, to query external data providers that have an API endpoint that returns XML.
  • The XML Source property only accepts XML text that you enter in manually or pass in through a text-based variable populated with XML data.
  • You can use the Start event object variable that references list items in your SharePoint site that contain columns with XML data.
  • To write changes back to an external XML source, you will need to use additional update actions related to your data source.

 

Configuration

 

Existing SharePoint Document

This example shows you how to use the SharePoint Online action, Call a SharePoint web service, to get an XML document from a document library and use it with the Update XML action. The workflow was upgraded and needs to add nodes of data to an XML document that lives in an existing SharePoint Document library within the site collection. By using the SharePoint REST API, we can still get to the contents of this document and use the Update XML action to add information to it.

 

  1. Drag the action, Call a SharePoint web service, onto your design canvas from the SharePoint Online grouping of actions.
     

     
  2. Configure the Connection property to point to an existing SharePoint Online connection.
     

     
  3. Enter the SharePoint REST API URL endpoint that will return the information you are looking for. Exact syntax for the URLs are beyond the scope of this document, but you can refer to Microsoft documentation that shows you how to work with files using the SharePoint REST API. In this example we have an HTTP Get request pulling in a specific document from a document library that is an XML document. Note, request headers can also be set to XML to give the response in an XML format as well.
     

     
  4. Configure a Result object variable to store the output result that comes back from the API call. The file will be stored in the Response content variable inside the object variable that gets created.
     

     
  5. In the Update XML action, populate the XML Source property by inserting the response variable from the SharePoint Online Object output variable. Select the object and drill down to select  the Response content variable. As shown in the animation below, this will hold the actual text of the XML document that we pulled in from the Call a SharePoint web service action.
     

     
  6. Use an XPath Query to set how you want the XML to be updated based on the node selected in the query.
     

     
  7. Configure the data to be updated by using specific XML text, variables combined with XML formatting, or a variable that contains the full XML text. The example in the image below is going to add a book node to the parent node named "catalog" as configured above in the XPath Query property.
     

     
  8. Store your updated XML result output in a text variable for use later in the workflow.
     

     
  9. You can update your XML data in SharePoint by adding another Call a SharePoint web service action to the workflow and configure it as an HTTP Put request type. In the following example, the action writes back to the SharePoint document library with the same REST endpoint as the first web service action in the workflow. Notice the property, Request content, has the Output variable named, Updated XML, that came from the earlier Update XML action. 
     

     

 

External XML Sources and Current Item

  1. For external XML web services outside of your SharePoint environment, you can use the action, Call a web service, to pull in XML data.
     

     
  2. Use the Response content results variable from Call a web service inside the Update XML action. In the below screenshot we are using the response xml content, "WebServiceResponseXML" from a web service call to add a child node to a column in a SharePoint list, "Weather Forecast XML", that contains XML for weather forecast history. Note, if your workflow starts by using the SharePoint start events for New list item and/or Update list item in the list, you can use the Start event variable to plug in XML information related to the current item that starts the workflow.
     

     
  3. Use an update event to write the data back to the item where the XML is stored. In this example, it is written to the SharePoint list item that the workflow is started against by using the action, SharePoint Online - Update items.
     

     

 

References


0 replies

Be the first to reply!

Reply