How to select the check box using scripted rest API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 09:55 PM
Hi Experts,
I have created a Label(week_off) and created 7 checkboxes (variables name:mon_day,tues_day,wednes_day,thurs_day,fri_day,satur_day,sun_day)
How to check the checkbox of mon_day & tues_day by using the scripted rest API?
The following value is coming from the 3rd party applcation:
monday
tuesday
Any sample script for this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 09:58 PM
Can you post the sample request body that you will receive it from 3rd party application.
Is that mon_day & tues_day is a field on table or a catalog variable?
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 10:01 PM
checkbox variable name:
Question is :monday, tuesday
Name is: mon_day, tues_day
value coming from third party are
weekoffdays : monday,tuesday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 10:59 PM
Thank you for sharing the variable values. Can you please share the sample request body payload from third party application as well.
Are we going to create a Service Request using the scripted API in ServiceNow?
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2022 11:15 PM
Hi,
You can try below script.
Bases on this you can validate and add your logic
if (current.variables.mon_day== "true" || current.variables.tues_day=="true" ) {
return 'Yes';
}
return 'No';
}
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar