Does the UI action script also works in Agent workspace as it works on standard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 11:32 AM
Does the UI action script also works in Agent workspace as it works on standard?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 11:41 AM
Hi @Rajat,
If your UI Action is a server side one, and want the function to work for agent workspace, Write your server side code in UI action and just checkbox on workspace form button it will work. and workspace client script is optional use it when you want client side functionality.
Regards,
Gunjan
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 01:46 PM
g_form.setValue('state', -5);
/////////////////////////////////////
// Set Mandatory fields on Pending
/////////////////////////////////////
g_form.setMandatory('u_pending_reason', true);
g_form.setMandatory('comments', true);
///////////////////////////////////////////////////
// Call this same UI Action again in order to
// run the server side function.
///////////////////////////////////////////////////
gsftSubmit(gel('sysverb_update'));
This above code is included in script and not in Workspace client script in ui action and it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 10:29 PM
Hi
Can you try below code
g_form.setValue('state', -5);
/////////////////////////////////////
// Set Mandatory fields on Pending
/////////////////////////////////////
g_form.setMandatory('u_pending_reason', true);
g_form.setMandatory('comments', true);
///////////////////////////////////////////////////
// Call this same UI Action again in order to
// run the server side function.
///////////////////////////////////////////////////
g_form.submit(g_form.getActionName());
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Gunjan Kiratkar
Consultant - ServiceNow, Cloudaction
Rising Star 2022
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2022 11:44 AM
It depends on what you are trying to do. If your ui action is all server side, then yes. But if you have a client side part and server side part like some do then no. Workspace UI actions have a separate client side script that runs.
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/workspace/task/configure-agent-workspace-ui-actions.html