LoveNintex
Canvas Initiate

Error while trying to Update XML

Jump to solution

Hello,

In my workflow, I am trying to update XML of a repeating section on my form.  I am using Nintex O365.

The data is saved in a Multi-Line Plain Text field called CERS Element Line Items.  I am able to parse the XML with no problem.  In a For Each Loop, I save the Output Index in a variable called itemElementIndex.  I use this same variable in an Update XML Action.  Below is a screenshot of the configuration of Update XML.

Regarding the long name at the end of the XPath query. I know it is right, because I am able to extract the data from the XML and I see the values in my History log.

I get the error: “An exception occurred while processing parameter [InputXML]”

What am I doing wrong?  What other information do you need?

 

LoveNintex_0-1626132736816.png

 

Labels: (1)
0 Kudos
Reply
10 Replies
LoveNintex
Canvas Initiate

Re: Error while trying to Update XML

Jump to solution

Hello Nintex Community,

Does anyone have any thoughts on this?

0 Kudos
Reply
kchaluvadi
Workflow Veteran

Re: Error while trying to Update XML

Jump to solution

Hi,

From the screenshot I understood that you are trying to replace the content in a specific node with "No", have you tried storing the updated XML in a variable (Result XML) and then to log history? Is the updated XML in correct format?

0 Kudos
Reply
LoveNintex
Canvas Initiate

Re: Error while trying to Update XML

Jump to solution

@kchaluvadi Thanks for your reply.  I logged the data in History (see below).  In this example, it was the first instance, which is showing as 0 (zero) in the XML.  Does this look right?

 //Items/Item/0/_dee529ff55b1e8e7385ed7bd90ef974a

Is it possible to update 1 item?  Or do I need to recreate the whole XML string?  If that is the case, any ideas on how I would do that?

0 Kudos
Reply
kchaluvadi
Workflow Veteran

Re: Error while trying to Update XML

Jump to solution

Hi

Is it possible to update 1 item? - Yes, as per the Nintex documentation, you can update as mentioned below.

Selected node(s) action

Specify the operation to perform on the selected node. Select one of the following options.

  • Replace Node Contents: Replaces all content within the XML node with the supplied value.
  • Add Child Node: Adds a new node from the supplied XML fragment.
  • Set Node Text: Sets the value of the XML node to the supplied text.

 

And you can store the result of the updated XML (last field in the action, Result XML). So, update your workflow action with a variable to store the result of updated xml. Since the "log history" has limitation of number of characters to print, add an email action, insert that variable in the "message" and send that email to yourself. Once you get the email, check if the xml is valid or not, there are lot of online xml validation sites

More help on Update XML from Nintex documentation, hope it helps.

0 Kudos
Reply
LoveNintex
Canvas Initiate

Re: Error while trying to Update XML

Jump to solution
I determined what my problem is, but I am not sure how to resolve it. When I use the Update XML action, it works fine if I hardcode the index number. When I use the index 1 in this example, //RepeaterData/Items/Item[‍1‍]/_6d18d179415d8084b66a218ecb9, it works fine. However, if I try to use an integer variable in place of the 1, it does not work - //RepeaterData/Items/Item[‍{Variable:intIndex}‍]/_6d18d179415d8084b66a218ecb931aaf. Do you have any idea why?
(PS I actually posted this as a separate question on this forum).
0 Kudos
Reply
kchaluvadi
Workflow Veteran

Re: Error while trying to Update XML

Jump to solution

Have you tried log the {Variable:intIndex}‍ ? 

 

 

0 Kudos
Reply
kchaluvadi
Workflow Veteran

Re: Error while trying to Update XML

Jump to solution

If Log prints correct value, 1, then the action that you are using did not like the way you are passing it. You can try different way using "Build String" action.

I just tried usig buildstring action, it worked, here is the screen shots ( I hard coded the intIndex to 1):

BuildStringActionBuildStringAction

 

Result in Log to History List action

Build String OutputBuild String Output

Hope this helps!

0 Kudos
Reply
LoveNintex
Canvas Initiate

Re: Error while trying to Update XML

Jump to solution

Yes.  It shows as 1

0 Kudos
Reply
kchaluvadi
Workflow Veteran

Re: Error while trying to Update XML

Jump to solution

Ok, as shown in srceen shots in my previous reply, use a build string action to build your xml node structure and store in a vairable, "txtNodePath", and pass this variavble to your "Update XML" action.

 

View solution in original post

0 Kudos
Reply