Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

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

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Yes this is correct. Since the business rule is running asynchronously.

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

so the info message doesnot work with asycn or the previous and current object won't work?

Hi,

 

Info message will not work as there is no running order in async BR, but you can use both current and previous objects in BR, it will work.

 

Regards,

SS

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

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