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.

no display message on async business rule?

saini
Tera Expert

(function executeRule(current, previous /*null when async*/ ) {


var gr = new GlideRecord("problem");
gr.initialize();
gr.short_description = current.short_description;
gr.insert();
gs.addInfoMessage(current.short_description);
gs.addInfoMessage(previous.short_description);


})(current, previous);

 

I wrote this async business rule  on incident table for update, it does create problem as expected but it doesnot display any info message. I also added in actions tab, add message and that message is also not dsiplayed. Now is it part of functionality to behave this way ?, explaination would be appreciated.  Thanks

1 ACCEPTED SOLUTION

If you look closely at the out-of-the-box example script:

(function executeRule(current, previous /*null when async*/) {

So current will work, previous won't work. It clearly mentions null when async.

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

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 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

View solution in original post

6 REPLIES 6

ya i double checked it  current will work but previous wont. Thanks

Snehangshu Sark
Mega Guru

Hi,

 

It's an expected behaviour, when you run an async BR, technically you are asking to run the BR script parallelly in the background, no need to wait to get result, once it's completed, you'd get the result. In such cases, there is no script running order and you won't see the info messages.

 

Regards,

SS

Please mark an appropriate response as correct if my answer replied to your question.