Remove add button from related list based on conditions

Poorva Bhawsar
Mega Sage

Hi Community,

 

I want to remove add button from one of the related list under that when change is requested for approval i.e. when state changes to assess, add button in this related list shouldn't be visible at all or when change is submitted for approval after that add button shouldn't be visible on this related list.

 

Thanks

1 ACCEPTED SOLUTION

Hi @Poorva Bhawsar ,

 

If you want to hide the "Add" button, then you need to modify the "Add" UI action on task_cmdb_ci_service table as per your conditions. If you want to modify this only for change_request, then remove 'change_request' from the 'com.snc.task.associate_ci' system property and add the UI action condition as below:

 

current.canCreate() && RP.isManyToMany() && parent.active == true && (gs.getProperty('com.snc.task.associate_ci').indexOf(parent.getTableName()) > -1 || (parent.getTableName() == 'change_request' && parent.state != '-4'))

 

//Assuming Asses state choice as -4

 

SunilKumar_P_0-1702886247016.png

 

 

Regards,

Sunil

View solution in original post

13 REPLIES 13

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Poorva Bhawsar 

 

Greetings!!

 

The solution is here

 

Go to Related list

Right click configure --> List control

Script the "Omit new condition" part like below:

 

                  if (change_state == 1/2/3/4) /

 

                  true;

 

                  else

 

                  false;

 

4. Click on Update.

 

https://www.servicenow.com/community/developer-forum/how-to-hide-new-edit-button-on-related-list-bas...

 

https://www.servicenow.com/community/developer-forum/ui-actions-i-want-to-hide-the-button-in-related...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

I want to remove add button not new button. Can you please help me with the add button.

Hi @Poorva Bhawsar 

 

Logical and steps will be same. Give a try in PDI and share feedback. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

There is nothing to add on for 'add button'.