How to hide New button from the list view which is opened by clicking on reference icon

Community Alums
Not applicable

Hi Team,

 

I have created a field called shipping address as in the below screenshot, its a reference field. After we click on the reference icon, it opens the list of locations(cmn_location), I do not want the New button to be visible there.

Note:The New button should be visible when we open cmn_location.LIST ,Or directly open the locations

 

Ankur20_0-1685456588553.png

 

1 ACCEPTED SOLUTION

@Community Alums 

I did the same for problem_id field on incident table and it removed new button on lookup list

if(RP.getParameterValue('sysparm_view') == 'sys_ref_list' && RP.getParameterValue('sysparm_target') == 'incident.problem_id')
	answer = true;
else
	answer = false;

AnkurBawiskar_4-1685542301084.png

 

 

It's showing when I opened problem list using problem.list

AnkurBawiskar_0-1685541914515.png

New button is hidden on lookup list

AnkurBawiskar_2-1685542006515.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

5 REPLIES 5

Community Alums
Not applicable

Can anyone help on this?

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

when you open that lookup list; you do right click on list header and in list control use Omit New condition script field and add that logic

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

@Community Alums 

I did the same for problem_id field on incident table and it removed new button on lookup list

if(RP.getParameterValue('sysparm_view') == 'sys_ref_list' && RP.getParameterValue('sysparm_target') == 'incident.problem_id')
	answer = true;
else
	answer = false;

AnkurBawiskar_4-1685542301084.png

 

 

It's showing when I opened problem list using problem.list

AnkurBawiskar_0-1685541914515.png

New button is hidden on lookup list

AnkurBawiskar_2-1685542006515.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

Community Alums
Not applicable

@Ankur Bawiskar  Actually if we do that it will also hide the New button from the locations table list view when we directly navigate over there.

is there any other way?