Previous field value not available in Notification on CMDB table (cmdb_ci_business_app)

SunilkumarP1632
Tera Contributor

Hi Team,

 

I am working on a notification requirement for Business Applications (cmdb_ci_business_app) where an email should be sent when the Operational Status changes, including both FROM and TO values.

 

Configuration details:

 

Table: cmdb_ci_business_app

Notification trigger:

Send when: Record Updated

Inserted: Unchecked

Condition: Operational status changes

 

Email content:

Previous Status: ${previous.operational_status}
Current Status: ${operational_status}

 

Observed behavior:

Notification triggers correctly on update

Current status value is populated

Previous status value is blank, even though the field value is clearly changing

 

preview 

SunilkumarP1632_0-1768362447970.png

 

SunilkumarP1632_1-1768362489381.png

 

 

 

Expected behavior (example)

 

If a Business Application has:

Operational Status = Operational

 

And it is updated to:

Operational Status = Non-Operational

 

Then the notification email should contain:

Previous Status: Operational
Current Status: Non-Operational

 

 

 

please help me here how to fix this 

7 REPLIES 7

DrewW
Mega Sage

Previous does not exist in the way you are using it.  You are going to have to use a mail script.  If that does not work out a business rule and using gs.eventQueue or a flow are your next options.

@DrewW  - 

 

could you please help me with flow or business rule .

A google or Bing search on 

"servicenow use gs.eventqueue to trigger a notification"

will get you all the instructions you need to use a business rule to get this done.

 

Dhanraj B
Giga Guru

I think you won't be able to fetch the previous value directly in email body. You can write a business rule in CMDB Business Application table, when the operational status changes fire an event. 

gs.eventQueue("event_name",current,previous.operational_status,null);

 

Then, change the notification trigger to "Event is fired". After that, you have to create an email script something like below.

 

(function runMailScript(current, template, email, email_action, event) {
    template.print(event.parm1);
})(current, template, email, email_action, event);

 

In your email body, call your mail script - ${mail_script:your_mail_script_name}. I believe this will help you to get the previous state.