UI Action workspace script - how to get values from variable fields on workspace form

mattburgess
Tera Expert

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

 

??

 

 

1 ACCEPTED SOLUTION

mattburgess
Tera Expert

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?

 

 

View solution in original post

12 REPLIES 12

Chaitanya ILCR
Mega Patron

Hi @mattburgess ,

use the GlideAjax way.

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Hi Chaitanya,

 

Thanks for the update.

 

I was also wondering once we retrieve the variable values how can we then mark those variables as mandatory on the SOW form with red line around the field in a workspace client script 

 

i.e.

 

g_form.setMandatory('variables.VARIABLE_NAME');

 

We need basically to copy the same behaviour inside the UI Action workspace client script that happens on UI Action Client script.

@mattburgess 

you want it to be done in client script or UI action?

I believe it should be accessible from UI action as well since it's accessible from client script as per my above post.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

@mattburgess 

So you are saying normal client script on RITM table is not able to access variable value using below syntax?

g_form.getValue('variables.variableName');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader