same name should be in both fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 03:48 AM
I want make Assign_to filed and resolved_by filed mandatory and no different names should assign in them ,
if different name occurs it is unable to submit the form .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 03:03 PM
Hi @aggarwaltan
To make it mandatory you can use UI policy and also check in UI policy if assigned To is not same resolved By, show error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 04:05 PM
@aggarwaltan You probably don't want assign_to and resolved_by fields mandatory when the form such as a request or an incident is created because resolved_by can't be filled in until it is resolved.
Probably want to have assigned_to and resolved_by fields to be filled when the state changes to "Resolved".
In this case for example on table Incident, edit business rule "mark_resolved".
function setResolutionFields() {
if (current.assigned_to.nil())
current.assigned_to = gs.getUserID();
current.resolved_by = current.assigned_to;
if (current.resolved_by.nil())
current.resolved_by = gs.getUserID();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 11:13 PM
Hi @aggarwaltan ,
You can write on submit client script like below. I have added condition that it should prevent submission on ticket resolve.
function onSubmit() {
var state = g_form.getValue('state');
if (state == 6) {
if (g_form.getValue('assigned_to') != g_form.getValue('resolved_by')) {
g_form.addErrorMessage('Assigned to and resolved by should be same.');
return false;
}
}
}
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 02:46 AM
Thank you for answering, you made my day.