- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 02:30 AM
Hi Everyone ,
I am calling System Property inside UI Action. But whenever I adding system property in UI Action , UI Action stops working - it becomes non clickable.
System Property:
Note- Both System Property and UI Action are same scope
cc: @Ankur Bawiskar @Pavankumar_1
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 02:48 AM
that's correct. you need to have script include if you have to use GlideAjax.
I hope you can create script which uses GlideAjax and the required client callable script include
this link has the sample script; enhance it as per your requirement
How do I access the system property in UI page client script?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 03:28 AM
1st thing -> put that code inside the callback method and not outside
that's the reason you are getting undefined for that variable
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 03:14 AM
This script example can help :
Client-side Script:
function getProperty(propertyKey) {
var ga = new GlideAjax('YourScriptIncludeName');
ga.addParam('sysparm_name', 'getPropertyValue');
ga.addParam('sysparm_property_key', propertyKey);
ga.getXML(function(response) {
var propertyValue = response.responseXML.documentElement.getAttribute('answer');
// Use the propertyValue as needed
alert('Property Value: ' + propertyValue);
});
}
Server Side script :
var YourScriptIncludeName = Class.create();
YourScriptIncludeName.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getPropertyValue: function() {
var propertyKey = this.getParameter('sysparm_property_key');
var propertyValue = gs.getProperty(propertyKey);
return propertyValue || '';
},
type: 'YourScriptIncludeName'
});
I hope this logic can help !!
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....