Delete field value from the list view should be impossible if field is set as mandatory

dev_K
Tera Contributor

Hi All,

 

 

How can I change the following behavior:

 

dev_K_0-1728389321896.png

 

 

 

when in a form view it is mandatory to add assigned to, however in the list view Im able to remove this value.

 

What shall I do in order to disable this possibility? When mandatory it should not be possible...

4 REPLIES 4

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @dev_K 

 

You need to add a code - Oncell edit client script

 

Example

 

AGLearnNGrow_0-1728394766526.png

 

 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
if (newValue == 1) {
alert('High Impact cannot be set on a list view.');
saveAndClose = false;
}
callback(saveAndClose);
}

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

palanikumar
Mega Sage

Convert your UI Policy to Data Policy. It will be mandatory in all the places including Scripts

Thank you,
Palani

Animesh Das2
Mega Sage

Hi @dev_K ,

 

You can write a onCellEdit client script to disable editing 'Assigned to' field.

 

Another way I believe to make the field mandatory at every place using the dictionary,

you can create 'Dictionary override' for 'Assigned to' field for your table if it is extending 'Task' table to make 'Assigned to' field mandatory.

If you table does not extend 'task' table then you can directly make the 'Assigned to' field mandatory from its dictionary entry.

AnimeshDas2_0-1728395526931.png

 

 

If this address your question, please mark this response correct by clicking on Accept as Solution and/or Kudos.

You may mark this helpful as well if it helps you.

Thanks, 

Animesh Das

 

Moin Kazi
Kilo Sage
Kilo Sage

Hi @dev_K ,

 

You need to to write Data policy to mark Assignment group and Assigned to fields mandatory. Data Policy execute while changing field info on Form View as well as List View.

This field most probably set as mandatory via UI policy and UI policy won't execute on list view changes.

 

Please mark my answer as correct and helpful if it works for you.

 

Regards

Moin