We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

make ownership group field mandatory with a banner message

OluseyiS3924078
Tera Contributor

i have a task to make the Ownership group field mandatory when the state of a review is changed from Draft to Review.

 

 

I  have a ui policy that does the following

 

Condition: Workflow is 'Review'

 

 

Action:  Mandatory:  True

                Vislble: True

 

 

i also have a script in the policy that does this:

g-form.addErrorMessage:('ownership_group', 'Please assign an ownership group before moving to Review'



i also have a business rule that does the following:


When:  Before

 

Conditions: Workflow changes to Review

 

insert: Checked

Update: Checked

 

Advanced

If (current.ownership_group.nil() {

   gs.addErrorMessage('Ownership Group is required when moving to Review');

   current.setAbortAction(true);

 

 

My issue is that regardless of whether the Ownership group is populated.  This message displays at the top - 'Ownership Group'

 

Is my policy and Business rule in conflict?  I should think not

1 REPLY 1

lpruit2
Mega Sage

Greetings @OluseyiS3924078. Can you provide screenshots of the error message and code snippets from the UI Policy and Business Rule? I see a few typos in the text provided above and it would help me better visualize what you are seeing to ensure we are troubleshooting the correct component. If you have the UI Policy that makes the Ownership group mandatory, I'm not sure if there is any added value to also having a Business Rule.