How to update the select box variable based on the list collector variable values in servicenow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi all,
iam stuck with the below requirement can anyone please help me out.
There is a custom table named "u_cost_manage" in that table there are three custom fields.
Supplier (reference) field, branch string field, and partner choice box (True/false)
Below is the requirement in a catalog item,
We have a list collector variable named "Branch" list collector, if the branch records are selected then if one of the records has partner as true, then we need to mark the Trusted partner variable select box (True/false) as true else it should be false.
Below is the client script i have tried.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi @Balaram7
Try this one-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hello @Balaram7 ,
I will recommend try using g_form.getValue instead of newValue on a List Collector, it returns a string of Sys IDs separated by commas ("sys_id1,sys_id2"). This is exactly what the IN operator in the Script Include needs.
If still doesn't work where are you stuck or what's the issue coming send screenshot..
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello @Balaram7 ,
List collector give value like val1,val2,val3 in comma separated string , and you have to check whether each branch is trusted or not so you can first convert string value into array format using stringVariable.split(',') method and then send each value in your glideAjax using for loop then you can get your required response true or false , once get true then break the for loop and update that trusted partner checkbox as true .
You can refer code suggested by @Tanushree Maiti but just break the loop once response get true .
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya
