Hide "ADD" Button

Shabbir1
Tera Contributor

Hi Team,

on problem we have a field region drop down (1usa  2 Europe) and in related list we have "change requests" in that we have "ADD" button we need to hide the 'ADD' button when region is USA and show when region is Europe can anyone suggest how to achieve this there is no omit option for "ADD" in list control and when i am checking in UI actions it is in change_request table .how can fetch problem field values on that UI action is it possible to do this..?

1 ACCEPTED SOLUTION

@Shabbir1 

parent object should work

parent object -> will be the problem record

See here, I was able to show the Add button only for PRB0000011 and hide for other problem

AnkurBawiskar_2-1742534375129.png

 

 

AnkurBawiskar_0-1742534288439.png

 

AnkurBawiskar_1-1742534326152.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Shivalika
Mega Sage

Hello @Shabbir1 

 

Yes, you need to write server side script. I am assuming if change request related list is appearing in problem, there must be a field which is connecting them. For eg- Problem can be parent of change request. 

 

In that case, you can easily dot walk in your UI action. 

 

Like - current.parent.region== 'xyz' (specify the region value here - then ADD button should come per your requirement. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Ankur Bawiskar
Tera Patron
Tera Patron

@Shabbir1 

update this OOB UI Action and add this extra condition which I highlighted in bold

ensure you give correct field name and choice value

URL: https://instanceName.service-now.com/nav_to.do?uri=sys_ui_action.do?sys_id=2bd010c8877b13005087af1e3...

RP.isRelatedList() && current.canCreate() && parent.active == true && (gs.getProperty('com.snc.task.add_change_request').split(',').indexOf(parent.getTableName()) > -1) && (parent.getTableName() == 'problem' && parent.region == 'europe')

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Shabbir1 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar Thank you for your response we are getting parent only when we are adding the ticket in the related list "change requests" otherwise parent is empty so in this case we care not able to fetch "parent.region"