Set assignment group based on contact type field in interaction when it is created

SK41
Giga Guru

Hi,

I have a requirement where i have to set assignment group through script and not allow user to change it. If the contact type field is "chat" then as soon as the interaction is created then it should assign to "Group A"and if interaction is created via email i.e: contact type field is "Email" then it should assign to "Group B".

I have created the onLoad client script but it is not working. Please help.

Group should get set at the same timeinteraction is created.

Kindly,helpme in this regard.

Thanks!

5 REPLIES 5

Vasantharajan N
Giga Sage
Giga Sage

Please post your script here to check why it is not working.


Thanks & Regards,
Vasanth

Ankita19
Tera Guru
Tera Guru

 

 

please first check:

Any other scripts setting the assignment group on load?

Is there a reference qualifier on the assignment group field?

use alert to check values proper get . 

To check please share following alert results:

function onLoad() {
    var cf = g_form.getValue('contact_field');
    alert('alert' + cf);
    if (cf == 'chat') {
        
        g_form.setValue('assignment_group', 'A');
        alert('alert1' + g_form.getValue('assignment_group'));
    }
else if(cf == 'email'){
 g_form.setValue('assignment_group', 'B');

  alert('alert2' + g_form.getValue('assignment_group'));
}

wrote the same script bt it is not working

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

when interaction is created from chat how are you setting the contact type?

When inbound action is executed you can set the contact type as Email

what did you start with and where are you stuck?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader