How to set How to call a Sy property from a JSON Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have a UX Macroponent Definition https://Yourinstance.service-now.com/sys_ux_macroponent.do?sys_id=6295cbe0c3b57250eee1fe8f050131bd&s...
In State variable I want to replace 7 from below query and set it from sys property dynamically but how to call it
"initialValue": {
"type": "JSON_LITERAL",
"value": "sys_created_onONLast 7 days@javascript:gs.beginningOfLast7Days()@javascript:gs.endOfLast7Days()"
},
I have tried calling a script include but not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You can try call script include when it is Client callable. Make sure this is checked and dont forget about security as client callable script includes can be called by any user. Refer to ApprovalDelegationUtil script include used ootb for My Approvals module
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
In servicenow you can’t directly reference a sys_property inside the static json of a ux macroponent initialValue field...instead you can expose the sys property value via a client callable script include or server logic and......return that value to the json state....
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Technical Consultant/Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ashish Kathait ,
Here it is not possible call the System Property and Script Include Directly.
In UI Builder Pages , if we want to execute any Server side scripts we Just need to Create a new Transform Data Broker .
Refer the below documentation on how to create the Transform Data Broker
In that data broker call your script include or write your logic there and return your result.
Let me know if you need any Guidance.
If my response finds helpful, mark my response as helpful and accept the solution.
