How to enable or disable “New” button in related list based on State of records in experience UI.

Rohan Madusanka
Kilo Contributor

The button "New" in related list should be enabled for users only if the status of record is in “Open” or “Need More Info” statuses. These records are in a custom table in Service Now and once the status changed to Submitted or Approval, this "New" button should be disabled.

 

find_real_file.png

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Rohan Madusanka ,

Please follow and replicate the below steps but as per your required buttons :

I removed my old reaction, I did not read correct. You should look at the Related list action:

find_real_file.png

Search for the New - Interaction (in your case search for your "New" )

find_real_file.png

 

Click on advanced view:

find_real_file.png

 

Add the following to the script condition:

&& parent.sys_class_name + "" !== "sn_hr_core_case" 

find_real_file.png

update:

Insert and stay.

Set the original one to inactive.

 

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

View solution in original post

6 REPLIES 6

Hi @Sandeep Dutta,

No Sandeep. My question was "How to enable or disable “New” button in related list based on State of records in experience UI". And the issue is couldn't derive record state from the answer you have given. As per the below conditions, I can check table name, parent table name etc. but can't see the data in a table to derive state.

find_real_file.png

Thanks,

Rohan.

@Sandeep Dutta, added below condition and it worked. Thank you for your quick response.

parseInt(parent.state) != '9' && parseInt(parent.state) != '8'