Make field mandatory in list view custom workspace

DevadharshiG
Tera Contributor

Hello,

 

        I make some of the fields mandatory in the dictionary level. It is validating while editing in the native view - list. but i tried clearing out that fields in the list view workspace and validation is not happening. It allowing me to clear the field.

 

      Please help me here to configure fields to be mandatory in workspace list view also.

3 REPLIES 3

M Iftikhar
Kilo Sage

Hi @DevadharshiG

 

To achieve this, you have following options:

  • Data Policies: Data policies can enforce mandatory fields on the server side. This ensures that the data is validated regardless of how it is entered (form, list, or through an integration). This is often the most robust solution.
  • onCellEdit Client Script: You can create an onCellEdit client script. This type of client script is specifically designed to trigger when a user modifies a cell in a list view. Within the script, you can check if the field you want to be mandatory is being cleared and prevent the change if it is.
  • UI Policy with 'List view' option: When creating a UI Policy, you can specify that it should apply to the list view. Ensure the "On cell edit" checkbox is ticked for the UI Policy. This will apply the policy's logic, including making fields mandatory, when a cell is edited in the list view.

Note: For your specific situation, creating a simple Data Policy that makes the desired field mandatory would be the most straightforward and reliable approach. If you require more complex, conditional logic for when a field should be mandatory in the list view, then an onCellEdit Client Script would be more appropriate.

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.

Ankur Bawiskar
Tera Patron
Tera Patron

@DevadharshiG 

you will require before update business rule OR data policy to check that

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Pradeep Thipani
Mega Sage

Hi @DevadharshiG ,

 

You can create On cell edit client script and make UI Type to all, then it will work as expected.

 

PradeepThipani_0-1757521522291.png

 

 

Thanks,

Pradeep

 

 

 

 

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep