UiPath Form with Checkboxes to be filled with multiple values

Hello Community and Moderators, i really need help with this scenario:
i have to build a form, with Create Form, with checkboxes; i have to pass values coming from a datatable column to checkboxes (these string values are similar to {“0068”, “0069”, “0070”…}) and the number of values to pass may vary every time (once maybe just {“0068”}, next time can be {“0072”,“0073”,“0074”}… so once only one checkbox will have a “true” value and all the others will be “false”, next time some checkboxes will have a true value and some false).
First question: how can i pass to the form these random groups of values when they are strings but i have to pass booleans instead? Second question: my user must be able to select more checkboxes together with existing ones or deselect those passed from the previous datatable. How to set these values as in the FormFieldsCollection to grant my user to collect all of them after his selection/deselection?
Many Many Many thanks for help, this scenario is really tricky for me!

1 Like

Hi
This could be achieved with some json manipulation. Current documentation for Form Activities Pack is very sparse and incomplete, probably there is a more convinient way, but the solution below has worked for me:
Here I am using Select Boxes element that can hold any number of checkboxes inside and aligns them horizontically (I have community UIPath and 1.1.6 version of Forms Activities Pack):

Basically, what we see on the form is rendered from a json that contains all information about each component (element) of the form. We can dynamically change part of that json from withtin logic tab of a component and the forms renderer will update components accordingy.
We can use advanced logic that will trigger an action that will dynamically update our checkboxes. In trigger part we check whether the Create From activity input argument that holds json for new checkboxes is not empty, and in actions part we use Merge Component Schema to dynamically create new checkboxes (basically what Merge Component Schema does it changes part of component’s (element’s) json and when json is changed renderer updates what we see on the form).

We can take a look at component’s json from edit menu and observe how forms renderer reacts to changes we make to component’s json:

Inside my workflow that creates the form with checkboxes, two arguments are passed to the Create Form activity, one holds the current states for checkboxes (true, false) that is binded with Select Boxes component’s values and the second is a json list of checkboxes. When Create Form activity executed, checkboxes are dynamically created and the values from the argument that holds current states for checkboxes assigned to the newly created checkboxes components. We can see what checkboxes were selected by user in FormFieldsOutputData output argument of Create Form activity:

6 Likes

Thank you very much mr Egorov, really helpful.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.