- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 08:26 PM
Hello, does anyone know how to hide a related link based on a condition?
Example: If state is in progress, then this related link will not show up.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 09:51 PM - edited 05-30-2024 10:05 PM
Hello,
-
Configure the UI Action:
- Name: Give your UI Action a descriptive name.
- Table: Select the table where you want the related link to appear (e.g.,
incident
). - Action name: Provide an action name (e.g.,
hide_related_link
). - Show Insert: Check this if you want the link to be available on new records.
- Show Update: Check this if you want the link to be available on existing records.
- Condition: This is where you'll add the condition to hide the related link.
Sample Condition Script
Here's an example condition script that hides the related link if the state is "In Progress":
// Check if the current record's state is "In Progress"
// Replace `state` with the actual field name if it's different
// Replace `2` with the actual value for "In Progress" if different
current.state == 'In Progress';
Regards,
Vaishnavi Lathkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 10:25 PM - edited 05-30-2024 10:25 PM
Is there a script in the script field for this configuration ? like if conditions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2024 01:24 AM
Hello Blitz,
To apply conditions at the script level and ensure related links are not hidden based on specific states, you need to utilize the conditions field provided in the ServiceNow UI action. This approach allows you to specify the criteria under which related links should be displayed or hidden, ensuring that the links remain visible or become hidden according to the defined states. By configuring the conditions field appropriately, you can achieve the desired behavior for related links based on the specific conditions you have set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 10:03 PM
Hello Blitz,
You can make use of condition field on UI action.
please refer below screen shot for you reference
Thanks,
Valmik Patil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 10:15 PM
Hi @Blitz ,
Please find the attach screenshot.
In condition => current.state != '2 ' here '2' is backend name of In progress state.
Please mark my response as correct and helpful if it helped solved your question.
Thanks,
Rohit Suryawanshi