How to make fields mandatory in list edit ??

vhari2
Tera Expert

I have a list of records in a related list . I would like to make couple of fields mandatory when the user tries to change the state to completed in list edit . I never used a on cell edit script . Can anyone help me with this ?? 

1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron
Kilo Patron

Configure data policy to make field mandatory in list view.

 

https://docs.servicenow.com/bundle/london-platform-administration/page/administer/field-administration/task/t_CreateADataPolicy.html

 

Regards,

Sachin

View solution in original post

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

Configure data policy to make field mandatory in list view.

 

https://docs.servicenow.com/bundle/london-platform-administration/page/administer/field-administration/task/t_CreateADataPolicy.html

 

Regards,

Sachin

Service_RNow
Mega Sage

Hi,

Create a BEFORE Business rule with filter condition as state | Changes to | Pending,close compelte with script as

(function executeRule(current, previous /*null when async*/) {

// Add your code here

if (current.work_notes.getDisplayValue() == null) {

//do something

current.setAbortAction(true);

gs.addInfoMessage('PASS YOUR CUSTOM MESSAGE HERE');

}

 

})(current, previous);

Please mark reply as Helpful/Correct, if applicable. Thanks!

 

Why do you need to write script if this is possible with configuration?

It doesn't make sense to maintain code for this simple requirement which is possible with configuration.

 

Regards,

Sachin