- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 12:33 PM
Hi Rhonda,
I can see that the script is not running because your condition is never true. Service offering is a reference field, and as such stores the sys_id of the record as it's value. You can select the name using Filter conditions, or change your condition to
current.service_offering.name == 'ACD' || current.service_offering.name == 'Call Center'
In the script, you can dot-walk to the caller's location's support so no GlideRecords are needed
function executeRule(current, previous /*null when async*/ ) {
// Check if the affected user (caller_id) is set
if (current.caller_id) {
if (current.caller_id.location) {
if (current.caller_id.location.u_location_support) {
// Set the Assignment Group field to the location's Location Support
current.assignment_group = current.caller_id.location.u_location_support;
// Set the Assigned To field to the location's Assignment Group
current.assigned_to = current.caller_id.location.u_assignment_group;
}
}
}
})(current, previous);
The last line doesn't make sense - assigned_to is a person, and location.u_assignment_group sounds like a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 12:44 PM
Thank you for your reply, I tried the script that you shared but it is not allowing me to save. Oh you are right about the last line, it should .... Also, I cant save the script you shared with me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 02:51 PM
The script is working but only after the assignment group is already populated and I save the incident. I want the automation to happen before saving.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 03:39 AM
A Business Rule will run before or after insert/update - that really means before the database action, so you need to submit/save the record either way. It sounds like you want to see the Assigned to and Assignment group fields populate on the form when the Service offering field is populated or changes. To do this you will need an onChange Client Script. Client scripts can't dot-walk to related fields, so your onChange Client Script will need to use GlideAjax to call a Script Include. This is an often-used tool to have in your belt. Here is an excellent guide on how to do this.
In your case If the newValue (service offering sys_id) is one of the two that belong to ACD or Call Center, you will pass in the caller_id as a parameter. The Script Include will run the GlideRecord from your first attempt and return the two custom fields for the client script to set on the form. Give the scripts a try, and if you're stuck post each script using the insert code icon </> and we'll get it sorted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2024 04:23 AM
Thank you for the resources...
This is what I have and it's still not working for me:
Client Script with service offering being the onChange field Name