Does the UI action script also works in Agent workspace as it works on standard?

Rajat15
Tera Contributor

Does the UI action script also works in Agent workspace as it works on standard?

4 REPLIES 4

Gunjan Kiratkar
Kilo Patron
Kilo Patron

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

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

Hi @Rajat ,

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

DrewW
Mega Sage
Mega Sage

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