Autopopulate Assignment group while creating Inc

praveen47
Tera Contributor

Hi All, 

 

I have one custom table "x_vul_data" not exteded to Task table, in this table two string fields "Feedback"& "Replies". Whenever any new record is inserted in this table we are creating incident by using BR, now the new requirement is  two fields in custom table any one field contains "Problem" -- key word I need to prepopulate "Helpdesk" is assignment group. This functionlaity i need to configure in Assignment rules.

I tried to create assignmet rule in table field choices this table is not showing for me

Can any one help me on this. 

 

@Ankur Bawiskar 

Thanks, 

Praveen D.

2 REPLIES 2

Danish Bhairag2
Tera Sage
Tera Sage

Hi @praveen47 ,

 

Instead of assignment rule u can use the existing BR which you are using to create incident on that table. You just need to add one condition in that BR in the script section.

 

if(current.feedback.indexOf('Problem') > -1 || current.replies.indexOf('Problem') > -1){// please use proper backend names of feedback n replies fields.

gr.assignment_group == "sys_id_of helpdesk group";

}else{

gr.assignment_group == "whatever u were filling earlier";

}

 

Thanks,

Danish

 

Aniket Chavan
Tera Sage
Tera Sage

Hello @praveen47 ,

You can achieve this by using "onBefore" or "onAfter" Business Rule for the "x_vul_data" table and It checks whether either the "Feedback" or "Replies" field contains the keyword "Problem" using the indexOf method. 

 

If the condition is true, it sets the assignment group to the sys_id of the "Helpdesk" group. If false, it sets the assignment group to the sys_id of the previous group.

(function executeRule(current, previous /*null when async*/) {

    // Check if either the "Feedback" or "Replies" field contains the keyword "Problem"
    if (current.feedback.indexOf('Problem') > -1 || current.replies.indexOf('Problem') > -1) {

        // Set the assignment group to the sys_id of the "Helpdesk" group
        current.assignment_group = "sys_id_of_helpdesk_group";

    } else {

        // Set the assignment group to whatever value you were filling earlier
        current.assignment_group = "sys_id_of_previous_group";

    }

})(current, previous);

 

Please replace "sys_id_of_helpdesk_group" with the actual sys_id of your "Helpdesk" group and "sys_id_of_previous_group" with the sys_id of the group you were filling earlier.

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket