cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Adding a node on a specific location in a repeating section

Hi guys, 

Scenario: 

I have a repeating section with approvers.

Name approverComments
Approver 1populated through WF
Approver 2populated through WF
Approver 3populated through WF

Each approver will get a task assigned (sequentially) and are also able to add an additional approver to the sequence. When approver 1 adds an additional approver, this approver needs to be added between node 1 and node 2 of my repeating section:

Name approverComments
Approver 1populated through WF
New approver
Approver 2populated through WF
Approver 3populated through WF

Did anyone get this working? 

I can add the user to the repeating section as an additional (last) node - not the correct outcome as the sequence of the approvers is important

Replacing the first node its contents with <ApproverName>name of first approver</ApproverName><ApproverComments>comments</ApproverComments></item><item><ApproverName>name of newly added approver</ApproverName><ApproverComments>comments</ApproverComments> results in an Update XML error and the workflow gets suspended. 

Hopefully someone made it happen already  

Thanks, 

Glenda

Reply
3 Replies
Workflow Hero

Re: Adding a node on a specific location in a repeating section

Manipulating repeating section is not very easy. You can read my blog about that here: Dynamic repeating section - how to however it mainly refers to altering the section dynamically, as the form's values are changed.

Also, be aware you cannot replace the firs row of the repeating section. This is always a hidden row, shouldn't be modified or deleted, as is used as a definition for the section.

So I would try to not replace it with a new, but to replace it with its contents + the new node.

Regards,

Tomasz

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Adding a node on a specific location in a repeating section

Hi Thomasz, 

Thank you for your response. I currently solved the problem by rebuilding the entire repeating section in my workflow in by the use of a loop (guess this is what you are referring to as well): 

  • Count items in repeating section
  • Query XML of node x
  • Check whether approver should be inserted
    • Y: Insert new approver by building the XML in a Build string action
    • N: Insert XML of current node x
  • ...
  • Update my column containing the XML

It works, but it is slower than I would like it to be

Could you maybe tell me a bit more about the following: 

Also, be aware you cannot replace the firs row of the repeating section. This is always a hidden row, shouldn't be modified or deleted, as is used as a definition for the section.

I have done quite some repeating section manipulations and I never really had a problem with modifying my first row (at least from the workflow)?

Regards, 

Glenda

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Adding a node on a specific location in a repeating section

Hi,

maybe I wasn't too precise. What I meant was that you shouldn't manipulate the first row on the form itself. If you go with the developer console you will find, that above your visible first row there is also a hidden one, so in fact the first is a different one than you see.

However manipulating the XML shouldn't bring any errors as long as you stay inline with the schema. Have you logged out the text you are building? Maybe there was an issue with the text you built?

Regards,

Tomasz

0 Kudos
Accept as Solution Reply