Sending new and old value in a notification?

Mike Newman
Giga Contributor

I am looking for a way to notify users when a field is changed on the Location table.

Is it possible for the notification to include the previous value as well as the new value?  I know there is a history of changes made in the system but is there a way to get that data onto the notification?

For example:
The manager of a Location1 is Manager1.  I change the manager of Location1 to Manager2 and hit save.

On my notification, I want it to say something like:


Manager of Location1 has been changed from Manager1 to Manager2


 

Any help is appreciated. Thanks!  -Mike

8 REPLIES 8

Create a before update Business Rule with condition as manager changes.

 

In script , previous.manager will give you the previous value and current.manager will give the present value.

 

Now you can trigger an event from the Business rule and send the above values as parameters and send notification when this event is fired.

SanjivMeher
Kilo Patron
Kilo Patron

I agree to what Nitesh suggested.

You can create an onAfter Business Rule with condition if Location Changes and pass current.location and previous.location as paramters in gs.evetQueue function.

You can then be able to use those two parameters in the notification body as ${event.parm1} and ${event.parm2}

 

https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_ScopedGlideSystemEventQueue_String...


Please mark this response as correct or helpful if it assisted you with your question.

Nitesh Balusu
Giga Guru

Write a new business rule on that table.

 

With conditions as:

Short description -->changes

OR

Description--> changes 

with all your fields.

 

Please refer to the screenshots. I put in gs.info() to just log the current and previous statements.

You need to do gs.eventqueue(current, parm1, parm2)

create a new event, and trigger your email notification with that event.

in the notification body call the parameters.

 

find_real_file.png

 

find_real_file.png

Deepika61
Tera Contributor

Hi All 

In this senario, i have to display two field values , how could i pass ?

Example;

basically when short description or description changes , then in notification i need to display short description old value and new value if it changed or description old value and new value if it change?

basically in the above business rule it only for one filed but how could i pass two field values?

Please help me on this

Deepika