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

Hi @Poorva Bhawsar 

 

Please share screen shot for reference please. Seems some miscommunication. 

*************************************************************************************************************
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]

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

After change request is submitted for approval. Add button shouldn't be visible for impacted services/cis related list on change form.

PoorvaBhawsar_0-1702883913890.png

I want to remove/hide add button once change request is submitted for approval.

 

Hello @Poorva Bhawsar ,

Please refer to the below article which might can help you to resolve you query.

Let me know your views on this or if you have any further queries.


Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

Regards,
Aniket

I have already checked this. I only want to remove this button once change request submitted for approval.

SunilKumar_P
Giga Sage

Hi @Poorva , Can  you try the below script in Omit new condition script box? This is to omit the new button based on the Parent state.

 

Omit new button is TRUE and below script

 

answer=true;
if (parent.state == '-4' ){
    answer=false;
}
 
If you want to remove the Omit button irrespective on the condition, just check omit new button check box.
 
Regards,
Sunil