- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2018 07:51 AM
Hi All,
I have a requirement, I need to check whether the variable value has changed in the RITM process and send the notification to the requested_for as the variable value you entered is updated.
Can you guys please help me on this.
Thanks
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2018 08:49 AM
Hi All,
Thanks for your reply,
I have created on submit client script and script include for checking the old and new values of the variable on the (RITM) and sending notification if it is changed. The below one is working.
Client script, on submit():
var el_id = g_sc_form.getControl("u_impact_assessment").id;
//u_impact_assessment it is the variable name
var orig_val = gel("sys_original."+ el_id).value;
var new_val = g_form.getValue("u_impact_assessment");
if(orig_val != new_val){
var ga = new GlideAjax('ModelCategoryDet');
ga.addParam('sysparm_name','sendNotification');
ga.addParam('sysparm_sys_id',g_form.getUniqueValue());
ga.getXML();
}
Script include:
sendNotification: function() {
var Sys_id = this.getParameter('sysparm_sys_id');
var gr = new GlideRecord("sc_req_item");
gr.get(Sys_id);
gs.eventQueue('XXXX',gr,'','');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2018 08:10 AM
You can create one more hidden variable and the requested for value is changed, you can copy that old value to the hidden variable using onChange client script and make your logic to work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2018 08:14 AM
current.variables.variablename.changes() should work in the business rule as fas as I can remember. Have you tried using it?
I do not think variable values are audited. So I do not think you can access its history but you can track the change in real time using the above function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-19-2018 08:20 AM
you can play with sys_history_line table where if you find "old" column is an empty then it means record has not updated/modified , if it contains some value it means variable value has changed.
try and let me know if you need any further help here.
in history line table variable stored in field column as "VARIABLE:<variable_name>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2018 08:49 AM
Hi All,
Thanks for your reply,
I have created on submit client script and script include for checking the old and new values of the variable on the (RITM) and sending notification if it is changed. The below one is working.
Client script, on submit():
var el_id = g_sc_form.getControl("u_impact_assessment").id;
//u_impact_assessment it is the variable name
var orig_val = gel("sys_original."+ el_id).value;
var new_val = g_form.getValue("u_impact_assessment");
if(orig_val != new_val){
var ga = new GlideAjax('ModelCategoryDet');
ga.addParam('sysparm_name','sendNotification');
ga.addParam('sysparm_sys_id',g_form.getUniqueValue());
ga.getXML();
}
Script include:
sendNotification: function() {
var Sys_id = this.getParameter('sysparm_sys_id');
var gr = new GlideRecord("sc_req_item");
gr.get(Sys_id);
gs.eventQueue('XXXX',gr,'','');
}