Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2022 02:30 AM
Hi,
you can use onChange + GlideAjax
onChange catalog client script on that variable "Select RITM"
UI Type - ALL
Applies on Catalog Item - True
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(oldValue != newValue){
var ga = new GlideAjax('checkRecords');
ga.addParam('sysparm_name', "checkRecordPresent");
ga.addParam('sysparm_ritm', newValue); // give here user_id variable name
ga.getXMLAnswer(function(answer){
if(answer != ''){
alert("Billing Rate Value is " + answer);
}
});
//Type appropriate comment here, and begin script below
}
}
Script Include: It should be client callable
var checkRecords = Class.create();
checkRecords.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkRecordPresent: function(){
var id = this.getParameter('sysparm_ritm');
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', id);
gr.query();
if(gr.next()){
return gr.variables.billingRateVariableName; // use valid variable name here
}
},
type: 'checkRecords'
});
Regards
Ankur
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader