- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2021 04:02 AM
Hi All,
I am trying to access display business rule scratchpad values into catalog client script but it always shows undefined. Can anyone help here. I think there is some minor mistake.
Actually there is a record producer to create an incident. Whenever the incident is created via the record producer, it will automatically assigned to service desk. But there I am trying to build one exclude condition.
Like if particular ci is selected, the it should go to "Team A Group" instead service desk . Only for that particular condition the assignment group should changed. There is a hidden reference variable in the record producer to do this. The hidden field is "assignment_group". So in the catalog client script i am trying to call the scratchpad and set the value but the scratchpad value shows undefined always. Am i doing any mistake here?
Is there anyway that scratchpad value to be called and used in catalog client script?
Display business rule on "Incident" Form :
Catalog Client Script which tried to call the scratchpad on :
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2021 06:00 AM
Hi,
Script Include: It should be client callable
var GetProperty = Class.create();
GetProperty.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetail: function(){
return gs.getProperty('propertyName1') + '@' + gs.getProperty('propertyName2');
},
type: 'GetProperty'
});
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('GetProperty');
ga.addParam('sysparm_name', "getDetail");
ga.getXMLAnswer(function(answer){
if(answer != ''){
var propertyValue1 = answer.split('@')[0];
var propertyValue2 = answer.split('@')[1];
// now compare
}
});
//Type appropriate comment here, and begin script below
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2021 06:00 AM
Hi,
Script Include: It should be client callable
var GetProperty = Class.create();
GetProperty.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetail: function(){
return gs.getProperty('propertyName1') + '@' + gs.getProperty('propertyName2');
},
type: 'GetProperty'
});
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('GetProperty');
ga.addParam('sysparm_name', "getDetail");
ga.getXMLAnswer(function(answer){
if(answer != ''){
var propertyValue1 = answer.split('@')[0];
var propertyValue2 = answer.split('@')[1];
// now compare
}
});
//Type appropriate comment here, and begin script below
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2021 07:44 AM
Hi Ankur,
Thanks.
'If' condition below works fine, but I want to use an 'else' condition logic and not sure how to include that in this script? my 'else' within this answer function is unable to call another function, so I need to find a way to access variables propertyvalue1 and 2 outside the answer function... Is this possible in anyway?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2021 07:59 AM
Hi,
why to use else condition?
if you will always be having property as not empty then no need of else
the if part is used to handle and compare the property values
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2024 05:45 AM
@Ankur Bawiskar , How to set the values for multiple properties values in different variables?