UI parameter for "List" field - what's the correct input type?

Max Nowak
Kilo Sage

Hi,

I've been tasked with adding an edit button to a details screen on the now agent app, and I can't seem to figure out how to do this for a field of type "List" (which seems to be a multi-select reference field).

 

For the general functionality, I created a function and an action item. I then created UI and data parameters for all fields that I want our agents to be able to edit. For reference fields, I'd select "Choice list" as UI parameter input type.

 

I can't seem to find the correct "Input type" on the ui parameter, or "Type" on the data parameter, for this field with the type "List". Selecting "Choice list" as input type on the UI parameter prevents me from selecting this field. I could select "Text" as input type, but this doesn't really result in anything usable. I've tried a few combinations, but the best I've managed was the field showing a list of Sys IDs.

 

Has anyone else experienced this, and maybe found a solution to make a field of type "List" editable?

2 REPLIES 2

Zachi
Tera Contributor

Hi Kilo Guru,

I faced the same. Did you found any solution? 

Zachi
Tera Contributor

Hi Kilo Guru,
I managed to find workaround for this:

Requirement: to enable users to add action to Incident action list field.

Step 1: In studio Create Action Item
Type: Script
Execution script :
//Logic to add action to action list field
(function WriteBackAction(input) {

if(input.action = '')
return;

var gr = new GlideRecord("incident");
if (!gr.get(input.sys_id)) {
gs.error("incident_add_action write-back action - failed to find incident");
gs.addErrorMessage(gs.getMessage("add action failed."));
return;
}

var gia = new GlideRecord("u_incident_actions");
gia.get(input.action);
var action = gia.u_action;

if(gr.u_action_list == '')
{
gr.u_action_list = action;
}
else
{

if(gr.u_action_list.includes(input.action))
{
gs.addErrorMessage(gs.getMessage("Action: "+ action + " already exists"));
return;

}

gr.u_action_list = gr.u_action_list + ',' + action;
}
gr.update();


})(input);

Use current record as condition : True

Step 2: Create Item Parameter for the Action item created in Step 1

Step 3: Create Function

Type: Action item
Context: Record
Action item: Step 1 name
Condition: Table name (incident)
Step 4: Create UI Parameter for the function created in Step 3
With Table name = "incident name and Field name = reference field of the type list. (In case you do not have add a filed to the table)

Step 5: Create Action parameter mapping for the function created in step 3.

Step 6: Add the Function to the mobile Form Screen where you want to add Watch list.

**In case you wish to enable remove action repeat all steps and on the script :
.
.
.
if(gr.u_action_list.includes(input.action))
{
gr.u_action_list = gr.u_action_list.replace( ',' +input.action,'');
}
.
.
.