Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Auto populate assignment group on incident form depend on the catalog item variable selection

Arjun Reddy Yer
Mega Sage

 

Required help @Vasantharajan N @Tanaji Patil 

Need to auto populate assignment group on incident form depend on the catalog item variable selection.

As when the user select an option from the drop down list on service portal page of a catalog item it should auto assign to a group based on the selected option.

 

On Service Portal:

ArjunReddyYer_0-1701858825214.png

Selection of Option from Dropdown list

ArjunReddyYer_1-1701859033581.png

Incident Form:

 

ArjunReddyYer_2-1701859379546.png

 

1 ACCEPTED SOLUTION

Try adding logs and see what are the logs;

var issueArr1 = ['telephony_application_access','Calls_quality_dropout','CUIC_reporting_dashboards', 'call_recording', 'add_modify_ccess', 'other_issue'];
// use array for more that 2 values to reduce code length
gs.info('ABC  my_telephony_issue_about = '+producer.variables.my_telephony_issue_about);
gs.info('ABC isPart of Issue arr = '+issueArr1.indexOf(producer.variables.my_telephony_issue_about) > -1);
if (issueArr1.indexOf(producer.variables.my_telephony_issue_about) > -1) {
gs.info('Inside Array 1 for group c3538fd81b493dd481df65f1f54bcb4f');
    current.assignment_group = 'c3538fd81b493dd481df65f1f54bcb4f';
}
if (producer.variables.my_telephony_issue_about == 'call_capture') {
    current.assignment_group = 'd7e483d01b893dd481df65f1f54bcb86';
};
if (producer.variables.my_telephony_issue_about == 'alvaria_workforce_management') {
    current.assignment_group = '97677a80dba7a5148837aa4dd396194c';
}
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

10 REPLIES 10

Hi,

Please try below:

 

var issueArr1 = ['telephony_application_access','Calls_quality_dropout','CUIC_reporting_dashboards','call_recording','add_modify_ccess','other_issue'];  
// use array for more that 2 values to reduce code length
if(issueArr1.indexOf(producer.variables.my_telephony_issue_about.toString())>-1){
 current.assignment_group = 'c3538fd81b493dd481df65f1f54bcb4f';
 }
 if(producer.variables.my_telephony_issue_about == 'call_capture')
 {
 current.assignment_group = 'd7e483d01b893dd481df65f1f54bcb86';
 };
 if(producer.variables.my_telephony_issue_about == 'alvaria_workforce_management')
 {
 current.assignment_group = '97677a80dba7a5148837aa4dd396194c'; 
 }

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Now it's not working for all the options

 

var issueArr1 = ['telephony_application_access','Calls_quality_dropout','CUIC_reporting_dashboards','call_recording','add_modify_ccess','other_issue'];

if(issueArr1.indexOf(producer.variables.my_telephony_issue_about.toString())>-1){

current.assignment_group = 'c3538fd81b493dd481df65f1f54bcb4f';






 if (producer.variables.my_telephony_issue_about == 'call_capture') {

     current.assignment_group = 'd7e483d01b893dd481df65f1f54bcb86';

 }

 if (producer.variables.my_telephony_issue_about == 'alvaria_workforce_management') {

     current.assignment_group = '97677a80dba7a5148837aa4dd396194c';

 }

Please try below:

var issueArr1 = ['telephony_application_access','Calls_quality_dropout','CUIC_reporting_dashboards', 'call_recording', 'add_modify_ccess', 'other_issue'];
// use array for more that 2 values to reduce code length
if (issueArr1.indexOf(producer.variables.my_telephony_issue_about) > -1) {
    current.assignment_group = 'c3538fd81b493dd481df65f1f54bcb4f';
}
if (producer.variables.my_telephony_issue_about == 'call_capture') {
    current.assignment_group = 'd7e483d01b893dd481df65f1f54bcb86';
};
if (producer.variables.my_telephony_issue_about == 'alvaria_workforce_management') {
    current.assignment_group = '97677a80dba7a5148837aa4dd396194c';
}
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

tried with below mentioned but it's not working

var issueArr1 = ['telephony_application_access','Calls_quality_dropout','CUIC_reporting_dashboards', 'call_recording', 'add_modify_ccess', 'other_issue'];
// use array for more that 2 values to reduce code length
if (issueArr1.indexOf(producer.variables.my_telephony_issue_about) > -1) {
    current.assignment_group = 'c3538fd81b493dd481df65f1f54bcb4f';
}
if (producer.variables.my_telephony_issue_about == 'call_capture') {
    current.assignment_group = 'd7e483d01b893dd481df65f1f54bcb86';
};
if (producer.variables.my_telephony_issue_about == 'alvaria_workforce_management') {
    current.assignment_group = '97677a80dba7a5148837aa4dd396194c';
}

Try adding logs and see what are the logs;

var issueArr1 = ['telephony_application_access','Calls_quality_dropout','CUIC_reporting_dashboards', 'call_recording', 'add_modify_ccess', 'other_issue'];
// use array for more that 2 values to reduce code length
gs.info('ABC  my_telephony_issue_about = '+producer.variables.my_telephony_issue_about);
gs.info('ABC isPart of Issue arr = '+issueArr1.indexOf(producer.variables.my_telephony_issue_about) > -1);
if (issueArr1.indexOf(producer.variables.my_telephony_issue_about) > -1) {
gs.info('Inside Array 1 for group c3538fd81b493dd481df65f1f54bcb4f');
    current.assignment_group = 'c3538fd81b493dd481df65f1f54bcb4f';
}
if (producer.variables.my_telephony_issue_about == 'call_capture') {
    current.assignment_group = 'd7e483d01b893dd481df65f1f54bcb86';
};
if (producer.variables.my_telephony_issue_about == 'alvaria_workforce_management') {
    current.assignment_group = '97677a80dba7a5148837aa4dd396194c';
}
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande