Need to make assigned to as mandatory after Assignment group changes saved on the incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 10:57 PM
Hi All,
Actually we have requirement that whenever if we change state to WIP and assignment group changes and save the incident form then assigned to make mandatory, while making changes to group , assigned to not mandatory after saved only it makes mandatory
Please give me suggestions on this
Thanks
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:17 PM
HI @Deepika61
If you want the Assigned To field to become mandatory only after the incident is updated (i.e., after saving the record), rather than immediately when the State or Assignment Group changes, you'll need to rely more on Business Rules than UI Policies.
Create a Business Rule to check when the State is set to "WIP" and the Assignment Group changes, and make the Assigned To field mandatory after the record is updated.
Create 'After Update' BR with conditions
current.state == 'WIP' && current.assignment_group != previous.assignment_group
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 08:48 PM
Thanks for the response, Actually i tried this approach, but in business rule i guess we are not make m,andatory, right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 10:05 PM
Hi @Deepika61
You're absolutely right! In a Business Rule, you can't directly make a field mandatory. The mandatory behavior is something that is controlled via UI policies and UI Policy Actions, not Business Rules.
Business Rule should be used for the validation logic: You can check if Assigned To is filled when the State is WIP and the Assignment Group has changed. If the Assigned To field is not filled, you can show an error message or prevent the record from being saved
UI Policy should be used to control the mandatory property of the field based on the conditions.
Create a new UI Policy for the Incident table.
- Set Conditions to check if:
- State is WIP.
- Assignment group is changed.
- In the UI Policy actions, set the Assigned To field to Mandatory = False (this will make the field optional when editing the record).
Create Before Update BR with Condition:
Check if STATE is "WIP" and Assignment group has changed.
Script: Check if Assigned To is empty and prevent save if necessary.
if (current.state == 'WIP' && current.assignment_group.changes()) {
if (!current.assigned_to) {
gs.addErrorMessage('Assigned To must be filled when State is WIP and Assignment Group is changed.');
current.setAbortAction(true); // Prevent save if Assigned To is empty
}
}
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:23 PM
you can use UI policy or onChange client script.
what did you start with and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader