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.

TRUE/FALSE field is not working

aahitha2
Mega Expert

Hi Team,

I have a true/false field(made_sla), this field need to populate as true or false based on two date&time fields(X&Y).

if(X>Y) then made_sla=TRUE

else if(X<Y) then made_sla=FALSE.

 

logic is working and logs also printing, but made_sla is always showing as "FALSE" we do not have default value defined for this field.

if (widnowstart > breachtime) {
current.made_sla = 'true';
//gs.addInfoMessage("made:" + current.made_sla);
} else if (widnowstart < breachtime) {
current.made_sla = 'false';

}

Addinfo mesages are coming correctly but field is not updating, i have tried business rule on Before and after.

What might be the reason why Made_sla not accepting TRUE value? can anyone help me what are the backend logic stoping except dictionary default value.

 

 

Thanks!

 

 

17 REPLIES 17

Using current.update() in a before business rule is considered bad practice.

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

aahitha2
Mega Expert

Hello,

AFTER business rule with current.update() also not working.
BEFORE business rule -> i am not using current.update BCZ its not best practice.

Same BEFORE business rule is working in DEV environment, this issue is in UAT environment.

Thanks,

Aahita

Any luck with what I mentioned on trying with setWorkflow(false)?

If my answer helped you in any way, please then mark it as helpful.

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

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn