- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2019 07:37 AM
I have a scripted rest api - post method created that will create a catalog item when the payload is sent to the endpoint in ServiceNow. I am just needing to populate a list collector variable, in which I need help on. I am receiving the values comma seperated (EX. Attr1, Attr2, etc,....).
As of right now, it is setup to query the table being referenced in the list collector variable, and provide one sys_id. When i set the variable to the sys_id on the form, it does find it and move it ot the selected side of the collector. I need it to be able to do this for multiple.
Thanks
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2019 07:30 PM
Hi jbugarin,
When you are receiving the values, are you getting the sys_id of the records? (sys_id in SNOW).
If you are getting the sys_id then all you need to do is
g_form.setValue("list_collector_variable_name", nameOfArray);
From a cat client script this works fine for me.
If you are not getting the sys_id then you would have to find a way to get the sys_id of the data. List Collector will only accept sys_id
Cheers,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2019 07:30 PM
Hi jbugarin,
When you are receiving the values, are you getting the sys_id of the records? (sys_id in SNOW).
If you are getting the sys_id then all you need to do is
g_form.setValue("list_collector_variable_name", nameOfArray);
From a cat client script this works fine for me.
If you are not getting the sys_id then you would have to find a way to get the sys_id of the data. List Collector will only accept sys_id
Cheers,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2019 08:59 AM
HI,
Thanks for the advice on this, but I was able to figure it out.
Did a while loop on the field, which queried the table the list collector is referencing along with the field query and pushed the list of sys_ids into an array.
Then I had set the list collector value as the array converted to a string(EX. sysid_1, sysid_2, etc). This set the collector with all the right values.
Thanks again