Can we display error message on Incident list view (listedit ACL), so that User can't leave field blank?

Rajanmehta
Mega Guru

Hello 

We are on Madrid version. Wanted to find out if it is possible to display error message when user tries to remove mandatory field on list view. We have ACL to restrict this mandatory field, but would like to display error message as well, if possible.

Please advise.

Thanks,

Rajan 

1 ACCEPTED SOLUTION

Hi Rajan,

So you can do this using before insert/update business rule with condition as below

use your field name here

current.<field> == ''

Script:

gs.addErrorMessage('Field <fieldName> cannot be left blank');

current.setAbortAction(true);

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

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

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rajan,

so you are saying you have a field which is mandatory and that is added to the list view; if any user tries to remove that field from the list view by personalizing the gear icon then message to be shown

This is not possible

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

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

Hi Ankur,

Sorry for not being clear on my question. What I am saying that, I have a mandatory filed (also it is reference field) and which is visible and editable on list view by ITIL users, provided they don't leave it blank. So if someone tries to keep it blank, error message should pop up on top saying that it's mandatory field. 

Hope this is clear now.

Thanks,

Rajan 

Hi Rajan,

So you can do this using before insert/update business rule with condition as below

use your field name here

current.<field> == ''

Script:

gs.addErrorMessage('Field <fieldName> cannot be left blank');

current.setAbortAction(true);

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

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

Thanks Ankur.

 

That worked. Cool. 

Sagar Pagar
Tera Patron

Hi Rajan,

 

You can try data policy as when you remove caller field data ie. Caller field to Empty

Then give error message “Caller field is mandatory” in incident list view 

Please refer below images get more idea about it,

 

Image 1- data policy for reference filed --> caller

find_real_file.png

 

Image 2- Error message on the list view

find_real_file.png

 

Please mark as Correct Answer/Helpful, if applicable.

 


Regards,

Sagar Pagar

The world works with ServiceNow