Controlling the Display of Buttons in Related Lists

hamatu
Tera Contributor

I am investigating whether it is possible to create a button in the related list of a supplier case form within a workspace and control its visibility based on changes in the values of records within that related list.

 

However, I have not been able to implement this yet.

Furthermore, I was unable to implement this using Script Conditions or Record Conditions.

 

The values to be evaluated in the records are “Priority” and “State.”

 

Here are the Script Conditions I’ve tried:

 

current.state == 1 (Failed)

current.state == ‘1’ (Failed)

current.state != 1 (Failed)

current.state != ‘1’ (Failed)

 

current.priority == 1 (Failed)

current.priority == '1' (Failed)

current.priority != 1 (Failed)

current.priority != '1' (Failed)

 

parent.state == 1 (Failed)

parent.state == ‘1’ (Failed)

parent.state != 1 (Failed)

parent.state != ‘1’ (Failed)

 

parent.priority == 1 (Failed)

parent.priority == ‘1’ (Failed)

parent.priority != 1 (Failed)

parent.priority != ‘1’ (Failed)

 

current.getValue(‘priority’) == ‘1’ (Failed)

parent.getValue(‘priority’) == ‘1’ (Failed)

 

current.getValue(‘priority’) != ‘1’ (Failed)

parent.getValue(‘priority’) != ‘1’ (Failed)

 

current.getValue(‘state’) == ‘1’ (Failed)

parent.getValue(‘state’) == ‘1’ (Failed)

 

current.getValue(‘state’) != ‘1’ (Failed)

parent.getValue(‘state’) != ‘1’ (Failed)

 

current.getValue(‘priority’) (Failed)

 

 

I tried all of the above and verified the record conditions in the same way, but it didn’t work.

Since the “priority” and “state” fields are displayed when the button appears, it seems the system recognizes these fields themselves, but the values within them do not appear to be loaded.

 

If anyone has any insight into this issue or knows of a solution, I would greatly appreciate your help. Thank you in advance.

 

hamatu_0-1793074684887.png

hamatu_1-1793074722449.png

 

 

1 ACCEPTED SOLUTION

Sandesh Powar
Kilo Sage

Hi @hamatu ,

I tested this scenario in my Instance using Declarative Actions and Dynamic Evaluation.

Interestingly, the condition works as expected when I use the Category field, but it doesn't behave as expected when I use the Priority field. Check for Category.

 

I've attached a screenshot showing the Category condition working as expected for comparison.


SandeshPowar_0-1793095193040.png

 

SandeshPowar_1-1793095235950.png

 

SandeshPowar_2-1793095269012.png


If you find this solution helpful, Mark this response as Helpful and Please Accept the solution.
Regards,

Sandesh Powar
ServiceNow Rising Star

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@hamatu 

you want to control related list button visibility based on State of parent record?

If yes then in condition you should compare Parent record state and not current state

current.parentField.priority or current.parentField.state

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regardless of the parent record's status, I want to control the display of a button based on changes in the values of records within the parent record's related list.

 

In other words, the parent record's values are irrelevant.

 

Is there a way to control the display of a button based on values within the related list?

@hamatu 

so you are saying the related list button i.e. List Banner button on that table should be shown only for few states of that child record?

Sandesh Powar
Kilo Sage

Hi @hamatu ,

I tested this scenario in my Instance using Declarative Actions and Dynamic Evaluation.

Interestingly, the condition works as expected when I use the Category field, but it doesn't behave as expected when I use the Priority field. Check for Category.

 

I've attached a screenshot showing the Category condition working as expected for comparison.


SandeshPowar_0-1793095193040.png

 

SandeshPowar_1-1793095235950.png

 

SandeshPowar_2-1793095269012.png


If you find this solution helpful, Mark this response as Helpful and Please Accept the solution.
Regards,

Sandesh Powar
ServiceNow Rising Star