Delete field value from the list view should be impossible if field is set as mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 06:35 AM
Hi All,
How can I change the following behavior:
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 06:39 AM
Hi @dev_K
You need to add a code - Oncell edit client script
Example
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]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 06:42 AM
Convert your UI Policy to Data Policy. It will be mandatory in all the places including Scripts
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 06:45 AM - edited 10-08-2024 06:53 AM
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 07:34 AM
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