Hide/show the UI action button based on the Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 05:29 AM
"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
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 06:16 AM
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>");
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 06:33 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
