Get usable JSON from NWC Task form / Repeater

  • 24 September 2021
  • 4 replies
  • 39 views

Badge +3

Hello,

 

I need to obtain all the field values from a task form and send it to an API.. Few times in the workflow.

I was wondering if I could get an usable JSON form of the Task form?

At least if I could move all of the controls inside a Repeater, will I be able to get useful JSON - the same way we used to get XML when using "Nintex for SharePoint" repeaters?

 

Sample form

19824iB8F86169E6BF6711.png

and the cryptic output I get. The JSON variables have some random text appended.

19825i19FA15B7E8CAEE83.png

 

Thanks in advance.


4 replies

Userlevel 4
Badge +10

Not sure if this is helpful or relevant to what you're trying to do, but I seem to be having luck getting collections into a JSON format with the following 4 actions:



  1. Create Text String 

    1. Input: Collection Variable Output: Text Variable



  2. Modify String

    1. Input: Text Variable Replace Substring: "" With string: " Output: Text Variable



  3. Modify String

    1. Input: Text Variable Replace Substring: "{ With string: { Output: Text Variable



  4. Modify String

    1. Input: Text Variable Replace Substring: }" With string: } Output: Text Variable




Once I run those 4 actions against my collection (Which I expect to be JSON already), it is a valid JSON string. 


 


Disclaimer: My collections are coming from built in actions and Xtension actions, not repeatable form sections. However, the formatting of the string in your screenshot is the same what I'm getting, so maybe it would work for you as well. 

Userlevel 5
Badge +19

@SanthoshKumar-R I believe that this is related to how form variables as passed to the workflow engine for interpretation. We have a similar feature request open to better handle Start Variables (form variables included), which should also fix this problem if you'd like to add your vote to it: https://nintex.uservoice.com/forums/430063-5-nintex-workflow-cloud/suggestions/39801832-improved-instance-start-data-naming.


 


Not sure that there is currently another way around this.

Badge +3
Thanks @bsikes. Thats good idea to make the JSON proper. But the data inside the JSON is cryptic. It doesn't allow to deserialise at the other end of the API.
Badge +3
@butlerj thanks for the response. Its related to Task forms. But yeah, conceptually I would like to get a JSON object for the whole form which shows meaningful names for columns rather than cryptic text. Looks like there is no option at the moment.

Reply