kanwarnitin
Design Dabbler

K2 Five: How to use Serialize List to Array

I have a list view and want to pass only selected records from this list to a REST endpoint which accepts them as a JSON array.

Therefore, I am exploring Serialize List to Array methods. Is my case a fit for using this method? Can some please share an example using this method? I am not clear how to prepare Serialized List as input from the List View?

 

https://help.nintex.com/en-US/k2five/devref/current/default.htm#SBrokers/SB-Serialization.htm

 

Thanks!

Labels: (1)
Tags (1)
0 Kudos
Reply
3 Replies
ConradMc
Cloud Wanderer

Re: K2 Five: How to use Serialize List to Array

Hi,

I have recently done this in K2 Five.

 

Logic

I loop through rows on the List View and use the Serialize Add Item To Array method:

ConradMc_1-1619519100563.png

I guess in your scenario you only want selected rows so you would need to do something like this:

ConradMc_2-1619519133768.png

 

Important: You will need to have a Data Label to store the Serialized Array.

  • You will use this as an input parameter
  • You will also use this to store the output (after updating it with the current row).

 

Input

ConradMc_0-1619533514968.png

Output

ConradMc_1-1619533528778.png

 

Advanced SmartObject

Of course in order to do this, your Advanced SmartObject needs to expose the method:

ConradMc_3-1619519260966.png

You will see the property that we referenced earlier below:

ConradMc_4-1619519302044.png

 

If you need assistance setting up the SmartObject, I would suggest watching the K2 tutorial as it covers aspects of serialization (link at bottom of page).

 

I am at the point where I am now trying to do the opposite, rather than submitting to a POST endpoint, I am trying to display complex data from a GET endpoint. My challenge is that I have lists within lists, and I want to display the data using List Views but I do not want to store it first (unless I have to).

 

If you are interested, my post is here: https://community.nintex.com/t5/K2-Five-Forum/Displaying-Deserialised-Typed-Array-on-a-List-View-or-...

 

Hope this helps, if you have managed to display List Data from a REST call on a List View, without storing any data, please let me know!

 

Thanks

This video shows how to use the REST Service Type to create a K2 Service Instance and SmartObject that will allow K2 SmartForms and workflows to consume data...
0 Kudos
Reply
kanwarnitin
Design Dabbler

Re: K2 Five: How to use Serialize List to Array

Thanks @ConradMc 

I am aware how to use "Serialize Add Item to Array" but I was actually asking about another method "Serialize List to Array". Do you know how to use that?

0 Kudos
Reply
ConradMc
Cloud Wanderer

Re: K2 Five: How to use Serialize List to Array

No, I couldn't get it to work properly. I found a blog elsewhere which suggested to use the Add Item to Array instead.

Reply