Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Set boolean flag via background script

sunil4050
Giga Contributor

In the holiday calendar cmn_schedule_span table there is a field "All Day" which is boolean. I am trying to update it from transform map as well as background script but unable to . Request you to please let me know if i am doing something wrong here

 

var gr = new GlideRecord('cmn_schedule_span');
gr.addEncodedQuery('sys_created_by=xxxxx');
gr.query();
while (gr.next()) {
gr.all_day=true;
//gr.type='exclude';
//gr.show_as='busy';
gr.update();
gs.print("Opened By==" + gr.all_day);
//gr.deleteMultiple();
}

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

7 REPLIES 7

Sravya9
ServiceNow Employee
ServiceNow Employee

Hi 

Instead of setting the value to 'true' or 'false' can you use 0 for false and 1 for true.

var gr = new GlideRecord('cmn_schedule_span');
gr.addEncodedQuery('sys_created_by=xxxxx');
gr.query();
while (gr.next()) {
gr.all_day=1; // 1 for true and 0 for false
gr.update();
}

Thanks,

Sravya

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks Mark. It did help me to resolve the issue