Hide/show the UI action button based on the Task

vinod6
Tera Contributor

"I have a task with the name Prepare. When I open this task, the "To" button should be visible, but for all other tasks, this button should not be visible. Please provide the script to achieve this." and how to convert the hardcoded link into gs.getproperty. Could you please help 

vinod6_0-1730899611128.png

 

Condition: current.task_name == 'Prepare'

https://dev.service-now.com/now/nav/ui/classic/params/target/alm_transfer_order.do

Above is condition is not working.

 

2 REPLIES 2

palanikumar
Giga Sage
Giga Sage

Hi,

Is the name field of the task table is "task_name"? update the condition with the correct field name

To retrieve value from Property create a property in the sys_properties table.

Your script should be

var url = gs.getProperty("<name of the property>");

Thank you,
Palani

Ankur Bawiskar
Tera Patron
Tera Patron

@vinod6 

Things to check

1) is the field name correct on your table and what's the type? Is it string type or reference type? based on that condition will change

2) are you comparing the correct value i.e. Prepare

3) create system property of type string and add that URL there in value

4) then update script as this

action.setRedirectURL(gs.getProperty('propertyName')); // give the property name here

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