Want to have a choice field for each item selected in a 'List' type field on a form

sd2097
Tera Guru

Hi everyone,

 

I got a requirement where we have a 'List' field which refers to the cmdb_ci_service table. The client wants us to have a different choice field which has choices - Yes and No, for each of the item selected in the List field. 

We gave them some workarounds-

1. Having 2 separate fields for Yes/No where they can selected the items accordingly.

2. Having a separate tab (since this is in the workspace) altogether.

 

They didn't approve the above two solutions. Can someone please help with the feasible workarounds to achieve the same?

 

Note: We want this in a table form (NOT on catalog)

 

 

Thanks

 

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

One option to get something close to this is to add one field with the type of Name-Value Pairs

https://docs.servicenow.com/bundle/xanadu-platform-administration/page/administer/reference-pages/re... 

 

https://docs.servicenow.com/bundle/xanadu-platform-administration/page/administer/field-administrati... 

 

With a Client Script onChange of the List field, if the list selections are being made on the form, you would populate this field with a JSON string containing the display value or whatever from each selected list record as the 'name' (list value # in the example below) with an empty 'value'.  This would look something like this on the form (not a workspace in this screenshot

BradBowman_0-1725882233610.png

Then after adding some form text, training/guidance, and an onSubmit Client Script to validate and enforce it, the user would be expected to populate each empty box with Yes or No.

 

Hi Brad,

 

Thanks for a detailed response. But what they want is, on selection of an item in the list variable, a new row should get added along with the display name of the item. I checked on a few articles, and I think to make that dynamic, it is not possible to do it in an onChange client script. 

We proposed a workaround for the same, and lets see how that goes.

 

But anyways, thanks for this as this will definitely come handy in the future.

 

Thanks,