How to hide New/Edit button on related list based on value of parent field. Urgent!!!

vaibhavdesai
Kilo Expert

Hello All,

My requirement is as follow.

I need to hide "New" button on "Incident Task" related list on Incident form. I can't use "List Control" option because I have to hide button based on state of incident. And in List Control we have only option of adding condition based on Roles.

I can use client script. But, I want that to be my last option. Anything else apart from client script which can work, will be really helpful.

Any idea? I am not expert in service-now.

Thanks in advance.:-)

Vaibhav

1 ACCEPTED SOLUTION

Hi Vaibhav,


The field "Omit new condition" is present post-dublin instances. Only thing you need to do is to personalize the List Control form and bring the "Omit new condition" field. Since your current instance has this field and other don't, you can (on your sandpit instance) remove this field from the List Control form , Save it. Again, redo it by bringing back the Omit new condition onto the form so as to capture in it an update set which can be further migrated to other instances.


View solution in original post

6 REPLIES 6

Inactive_Use167
Mega Expert

You can write a condition in UI action based upon your requirement.



e.g current.incident_state==7


Hi harish,



Yes, I can do that. But, issue is "New" Button is in Global Scope. I can create new button with changed scope. But, lot of rework. You know any other way?



Thanks,


Vaibhav


kunal16
Tera Expert

Vaibhav,


There is provision in the List Control to Omit "New" button based on some conditions. You need to write a script under the field "Omit new condition" such as to hide New button on Incident task related list. Steps to write this script:


1. Right click on the related list Incident task


2. Go to Configure -> List Control


3. Script the "Omit new condition" part like below:


                  if (incident_state == 7) //say '7' is the 'InProgress' state


                  true;


                  else


                  false;


4. Click on Update.



Hope this helps.


Hi kunal,



Yes, I did exactly like this. Thing is one of my Instance is on Fuji patch 9. Where I have Field "Omit New Condition". So I wrote below script.



if(parent.state == 6 || parent.state == 7){


  current.omit_new_button = true;


}



And it worked as expected! 🙂



But, issue is I have sandpit on patch 9. Other 3 instances including PROD is on patch 4. Where this field "Omit New Condition" is not there.:-(


Not sure this issue is from service-now end.



I am stuck because of this.