I am trying to directly display within an alert message, the current incident's priority number only

DPP1
Tera Contributor

Hi ServiceNow SysAdmin Forum

 

I am trying to directly display within an alert message, the current incident's priority number only not the priority value such as 1 - Critical, 2 - High, etc., through a Business Rule without updating the Advanced option to " True ", without using script but directly by only using the Add Message option in Actions tab

 

=====

Incident with the priority of [ ${current.priority} ] has been created / updated

=====

 

Thanks

 

DPP

10 REPLIES 10

DPP1
Tera Contributor

Hi ServiceNow SysAdmin Forum

 

I am trying to directly display within an alert message, the current incident's priority number only not the priority value such as 1 - Critical, 2 - High, etc., through a Business Rule without updating the Advanced option to " True ", without using script but directly by only using the Add Message option in Actions tab

 

When I use the add message text as below, the alert message shows the priority as its displayed value of 1 - Critical, 2 - High, etc., instead of 1, 2, etc.

 

=====

Incident with the priority of [ ${current.priority} ] has been created / updated

=====

 

Thanks

 

DPP

@DPP1 Can you share the code that you have tried till now, or some screenshots of the BR. 

Ankur Bawiskar
Tera Patron

@DPP1 

you can use after insert and update business rule and show that message

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

    // Add your code here
    if (current.operation() == 'insert')
        gs.addInfoMessage("Incident with the priority of " + current.priority.getDisplayValue() + " has been created");
    else if (current.operation() == 'update')
        gs.addInfoMessage("Incident with the priority of " + current.priority.getDisplayValue() + " has been updated");


})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Hi Ankur

 

Thanks for your time to provide your update.

 

However, I was not looking for a script meaning then I would have to update the Advanced option to " True " to write it to be used, but instead I was looking to directly utilise / fetch the current incident priority numeric value i.e., 1, 2, etc., not its displayed value i.e., 1 - Critical, 2 - High, etc., within an alert message by updating the Add Message option to " True " under the Actions tab.

 

Thanks

 

DPP