I need to call a UI Message in Business Rule

nageshmetri
Kilo Contributor

Hi all,

I have a Requirement as "When trying to cancel a incident record with an active incident task an error message should be thrown to prompt the

user as 'Kindly close/cancel the associated incident tasks to cancel the incident''

For this I wrote a Business Rule & the same is working fine but without display message.

I have created a Message in SYSTEM UI > MESSAGES and the same i need to call in the Business rule . But the script which i have wrote is not

displaying prompt message

The script which i have written in Business Rule is as follows,

var inc = new GlideRecord('incident_task');

var thisincident = current.sys_id;

inc.addQuery('incident',thisincident);

inc.addQuery('active',true);

inc.query();

while (inc.next()) {

  gs.getMessage('Kindly_close/cancel_the_ associated_incident_tasks_to_cancel_the_incident');

current.setAbortAction(true);

}

Kindly help me to call a message "Kindly close/cancel the associated incident tasks to cancel the incident'' which i have created in SYSTEM UI>MESSAGES

in the Business Rule

4 REPLIES 4

Dave Smith1
ServiceNow Employee
ServiceNow Employee

Anurag Tripathi
Mega Patron
Mega Patron

You are calling the message but what are you doing with it,



Do this



gs.addInfoMessage(gs.getMessage('Kindly_close/cancel_the_ associated_incident_tasks_to_cancel_the_incident'));


-Anurag

Thanks David.


Its working fine.





On 3 August 2017 at 20:22, t_anurag <community-no-reply@servicenow.com>


Its working fine.


That's great.   Could you possibly mark the question answered, then?   Just in case it's of help to others.