- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 11:12 AM
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();
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2020 09:40 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 11:26 AM
Hi there,
Have you tried adding setWorkflow(false)?
Something like this:
(function() {
var gr = new GlideRecord('cmn_schedule_span');
gr.addEncodedQuery('sys_created_by=xxxxx');
gr.query();
while(gr.next()) {
gr.all_day=true;
gr.setWorkflow(false);
gr.update();
}
})();
Obviously, this might cause that the cmn_schedule records are not updated. So you could also have a look which Business Rules, etc. are causing some records not to be updated without setWorkfow(false).
If my answer helped you in any way, please then mark it as helpful.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 11:32 AM
Hi,
Yes,as Mark Roethof suggested you need to use setWorkflow(false) in order to avoid other BR running on same table.
try with below code.
var gr=new GlideRecord('cmn_schedule_span');
gr.addEncodedQuery('sys_created_by=xxxx^active=false');
gr.query();
while(gr.next())
{
gr.all_day=true;
gr.setWorkflow(false);
gr.update();
}
gs.print('updated');
Thanks,
Pooja M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 11:33 AM
Hi sunil4050,
You cannot set that field to true or false using any script(background or fix script). You have to do it manually.This field is not like a normal True/false field. Its something different
We had this requirement earlier but ended up in doing it manually as we couldn't find the solution for that.
Mark helpful and correct if it helps.
Thanks,
CB

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 09:49 PM
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