How would I add a message using addInfoMessage to a incident that is a child incident using a business rule?

mitchmo2
Mega Expert

I am trying to add an addInfoMessage that will say You are viewing the child incident. A business rule will run and check the parent field and if the parent field is filled then it will show the message and if it doesn't do nothing. I tried this code, but can get it to work

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

  var childBanner = new Gliderecord('incident');

  childBanner.query();

if(childBanner.parent){

    childBanner.addInfoMessage("You are viewing the child incident");

}

else{

 return;

 

}

 return;

})(current, previous);

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

In your code you have used 'childBanner.addInfoMessage("You are viewing the child incident") instead of gs.addInfoMessage('You are viewing the child incident'). Please provide the condition as below,

find_real_file.png

In script:-

find_real_file.png

View solution in original post

2 REPLIES 2

mitchmo2
Mega Expert

find_real_file.png

Heres the business rule

Hi,

In your code you have used 'childBanner.addInfoMessage("You are viewing the child incident") instead of gs.addInfoMessage('You are viewing the child incident'). Please provide the condition as below,

find_real_file.png

In script:-

find_real_file.png