- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 04:11 AM
Hi
Does anyone know how to access variable fields in Request Item / Catalog Task on Service Operations workspace when checking using a UI Action > Workspace client script
The traditional way of accessing variables doesnt seem to work in workspace.....
i.e. Native
g_form.getValue('variables.VARIABLE_NAME')
Workspace
??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 02:55 AM
Hi - ok so we have figured out that we will need to hide the UI Action button in SOW through UI Action visibility as the logic in native UI Action will not work the same way in Workspace without serious rework (i.e. using GlideAjax to do the logic to check if all variables are filled in etc)
Then we are going to create a Declarative Action (DA) to mimic the same behavior in Workspace and set that visible on the SOW form.
Thanks for your help.
It does seem that reworking complex UI action scripts in SOW is very difficult and therefore using DA to do the same logic for workspace seems the right approach.
Agree?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 02:17 AM
have you configured the variable editor so that it's visible in workspace view as well and then try that script?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 02:31 AM
I am able to get the variable value
1) RITM form has variable editor in configurable workspace in workspace view
2) I wrote onLoad client script on sc_req_item table and is able to access the value of variable "Application Type"
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
01-03-2025 02:38 AM
Yes on a client script itself it should be ok as you can run as ALL.
But my use case is UI Action button "close" so UI Action button has 2 client scripts
- Native
- Workspace
Also you need to tick to create a second UI Action button for workspace so you see 2 close buttons...not ideal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 02:39 AM
when you want UI action logic in workspace you need to write in workspace client script.
why 2 close buttons?
It's single button but in backend system creates a UX button which works in workspace
What's your challenge? I didn't get it
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 02:31 AM
Variable editor is available in SOW workspace on RITM and catalog task
But when i am trying to script g_form methods for variables inside the editor such as getValue and setValue and setMandatory it doesnt seem to recognise those variables from the workspace client script.
Basically my ask is to prevent closure if specific variables are not completed.
- Check Variables value
- If empty
- Set Mandatory variables and prevent closure
This works for UI Action close button in Native UI (as it is also visible in SOW)
But I need to also add some additional logic to include modal pop up in SOW so i had to add a new workspace Close button as g_modal doesnt work in native client script. Hence i need to also then mimic the same behaviour in workspace client script.