- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:18 AM
What is the best way to call system property in a client script (script include) for a catalog item ???
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:36 AM
Hi,
you cannot get system property value in client side directly.
you need to use GlideAjax for this and return the property value from the ajax function
Example
Script Include: It should be client callable
var checkRecords = Class.create();
checkRecords.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkRecordPresent: function(){
return gs.getProperty('property_name'); // name of property here
},
type: 'checkRecords'
});
Client Script:
var ga = new GlideAjax('checkRecords');
ga.addParam('sysparm_name', "checkRecordPresent");
ga.getXMLAnswer(function(answer){
if(answer != ''){
alert(answer); // this gives you the property value
}
});
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
‎09-08-2022 06:21 AM
gs.getProperty("propertyName") can be used in script include or Business rule, workflow etc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:22 AM
hello Rathan ,
you can call a system property in server side script only which is a script include in your case like below
Not only in script include , you can call it in any server side scripting
gs.getProperty('your+property_name');
Hope this helps
mark my answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:26 AM
In client script you can use it using g_scratchpad’
So capture the property value in display business rule using g_scratchpad and then access the g_scrtchpad variable in any client script
Please mark my answers helpful and correct if they really helped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2022 06:36 AM
Hi,
you cannot get system property value in client side directly.
you need to use GlideAjax for this and return the property value from the ajax function
Example
Script Include: It should be client callable
var checkRecords = Class.create();
checkRecords.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkRecordPresent: function(){
return gs.getProperty('property_name'); // name of property here
},
type: 'checkRecords'
});
Client Script:
var ga = new GlideAjax('checkRecords');
ga.addParam('sysparm_name', "checkRecordPresent");
ga.getXMLAnswer(function(answer){
if(answer != ''){
alert(answer); // this gives you the property value
}
});
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
