Assignment group in the incident form auto-populate based on the location in the record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2025 12:10 AM
Hi,
I want to create a record producer. I'm attaching the wireframe here. This is my requirement.
1. I have created some demo users and set their locations as India, US, LATAM and Turkey.In the record producer, in the Open on behalf of the user field, I will give a user who is affected with an issue. The location field in the record producer is dynamically populating based on the open on behalf of the user field. If the location field is populating with values India, US or LATAM I want the assignment group to be auto-populated with the group IT-EXPERIENCE. But I tried many methods and I didn't get it. Please help me on this.
2. If location field in the record producer is dynamically populated with Turkey, then another field is visible called Issue belongs to . It has 4 choices, IT, Lab, ServiceDEsk, SDE. If the location is dynamically populated with Turkey and if I select IT from the Issue belongs to field, then the assignment group in the incident has to be auto-populated with Turkey IT. Similarly, if the location is dynamically populated with Turkey and if I select Lab from the Issue belongs to field, then the assignment group in the incident has to be auto-populated with Turkey Lab.
How to do this? I'm trying this for a long time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2025 12:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2025 10:44 AM - edited 01-25-2025 10:50 AM
Hello @NishaB
Update the producer script as shown below to populate the assignment_group based on user location and issue_belongs_to variables.
// Define sys_ids for assignment groups
var IT_EXPERIENCE_GROUP = 'sys_id_of_IT_EXPERIENCE';
var TURKEY_IT_GROUP = 'sys_id_of_Turkey_IT';
var TURKEY_LAB_GROUP = 'sys_id_of_Turkey_Lab';
// Check the location and set the assignment group accordingly
if (producer.location == 'India' || producer.location == 'US' || producer.location == 'Latam') {
// Assign to IT-EXPERIENCE group
current.assignment_group = IT_EXPERIENCE_GROUP;
} else if (producer.location == 'Turkey') {
// Check the 'issue_belongs_to' variable for further logic
if (producer.issue_belongs_to == 'IT') {
// Assign to Turkey IT group
current.assignment_group = TURKEY_IT_GROUP;
} else if (producer.issue_belongs_to == 'Lab') {
// Assign to Turkey Lab group
current.assignment_group = TURKEY_LAB_GROUP;
}
}
var incRPUtil = new LinkRecordProducerToIncident();
incRPUtil.linkRecordProducerToParentIncident(RP.getParameterValue('sysparm_parent_sys_id'), current);
You can also modify the onChange client scripts on location field:
function onChange(control, oldValue, newValue) {
if (!newValue) return;
// Hide Issue belongs to field by default
g_form.setVisible('issue_belongs_to', false);
g_form.clearValue('issue_belongs_to');
if (newValue === 'Turkey') {
g_form.setVisible('issue_belongs_to', true); // Show Issue belongs to field
}
}
Note:
- You don't need onChange client scripts on Issue belongs to field.
- Update the record producer script with sys_id's of assignment group mentioned.
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 05:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2025 06:40 PM
Hello @NishaB
Please verify if you are using the back-end value for country and issue it belongs to.
Thank You
Juhi Poddar