Previous field value not available in Notification on CMDB table (cmdb_ci_business_app)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday - last edited Tuesday
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday - last edited Tuesday
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.
