Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to select the check box using scripted rest API?

SK36
Tera Contributor

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?

5 REPLIES 5

Vasantharajan N
Tera Sage

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

checkbox variable name:

Question is :monday, tuesday

Name is: mon_day, tues_day

value coming from third party are 

weekoffdays : monday,tuesday

 

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

PavanK960672992
Mega Patron

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

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar