Hi, We are facing issue on the list collector variable for triggering to the alternate fulfillers

rajeshKongamudi
Tera Contributor

 

 

Hi Community, can someone please help us on this issue as derived below.
 
We are facing issue on the list collector variable, basically we have 8 values in it for one of the list collector values (Mail Nickname: for exchange) it should goes to the fulfillment task (Exchange group) for the remaining list collector values it should goes to the (Service desk), But in this case it is not working as like it should, it has to go to the exchange group if we select(Mail Nickname: for exchange) for remaining it should goes to the ServiceDesk.  I have written script for it. we need to trigger the fulfiller if we select both the fulfillment group values it should trigger for both, can someone please help on this issue. thanks in advance.
answer = [];
var applist = [];
//var taskID;
var group = current.variables.action_types_List_collector;
// gs.info('roles rajesh ' + group);
var approval = new GlideRecord('question_choice');
approval.addEncodedQuery('question=090ed92887d40210b180bae09bbb35cb^sys_idIN' + group);
approval.orderByDesc();
approval.query();
while (approval.next()) {
    gs.info('while rajesh ');
    applist.push(approval.value.toString());
}
for (var i = 0; i < applist.length; i++) {
    gs.info('for rajesh ');
    if (applist[i] == 'Mail Nickname: for exchange') {
        var Match_LRQA_Exchange = "true";
    } else if (applist[i] != 'Mail Nickname: for exchange') {
        var Match_service_desk = "true";
    }
}
if (Match_LRQA_Exchange == 'true') {
    //answer.push(current.variables.requested_for.manager);
    task.short_description = 'Change' + ' ' + current.variables.action_types_List_collector.getDisplayValue() + '  ' + 'for ' + current.variables.requested_for.getDisplayValue();
var prop1 = gs.getProperty("Sys_LRQA_exchange");
 task.assignment_group = prop1;
}
if (Match_service_desk == 'true') {
    task.short_description = 'Change' + ' ' + current.variables.action_types_List_collector.getDisplayValue() + '  ' + 'for ' + current.variables.requested_for.getDisplayValue();
  var prop2  = gs.getProperty("Sys_LRQA_ServiceDesk");
task.assignment_group  = prop2;
 
    //answer.push('181e499e878605109c9ea9330cbb35fd');
}                                      

 

rajeshKongamudi_0-1707737146354.png

 

Here i have selected Mail nickname value

rajeshKongamudi_1-1707737226247.png

Going to the service desk group instead exchange group

rajeshKongamudi_2-1707737297079.png

 

 

3 REPLIES 3

ARUN MANOJ
Tera Contributor

Where the group variable initialize is an array variable right. so, loop it and try to run

 

Subhashis Ratna
Tera Guru

Hello @rajeshKongamudi 

I have modified your code with my logic and tried in my PDI . Could you please try my logic to achieve your requirement?

Updated Code :

Scenario 1 :

var applist = ['Mail Nickname: for exchange', 'Department'];

var match_LRQA_Exchange = false;
var match_service_desk = false;

for (var i = 0; i < applist.length; i++) {
    gs.info('Beerus is Checking: ' + applist[i]);

    if (applist[i] == 'Mail Nickname: for exchange') {
        match_LRQA_Exchange = true;
    } else if (applist[i] == 'Department') {
        match_service_desk = true;
    }
}

var task_short_description = '';
var task_assignment_group = '';

if (match_LRQA_Exchange) {
    task_short_description += 'Beerus 1';
    task_assignment_group += 'Exchange Group SYSID';
}

if (match_service_desk) {
    if (task_short_description) {
        task_short_description += ' | ';
        task_assignment_group += ' | ';
    }

    task_short_description += 'Beerus 2';
    task_assignment_group += 'Sys_LRQA_ServiceDesk SYSID';
}

gs.info("Final Output : " + 'match_LRQA_Exchange is ' + match_LRQA_Exchange  + ' match_service_desk is ' + match_service_desk  + ' ' + task_short_description + ' --- ' + task_assignment_group);


Screenshot 1 :

Subhashisr7_1-1707741373201.png



Scenario 2 :

var applist = ['Department','Title'];
var match_LRQA_Exchange = false;
var match_service_desk = false;
for (var i = 0; i < applist.length; i++) {
    gs.info('Beerus is Checking: ' + applist[i]);

    if (applist[i] == 'Mail Nickname: for exchange') {
        match_LRQA_Exchange = true;
    } else if (applist[i] != 'Mail Nickname: for exchange') {
        match_service_desk = true;
    }
}
var task_short_description = '';
var task_assignment_group = '';

if (match_LRQA_Exchange) {
    task_short_description += 'Beerus 1';
    task_assignment_group += 'Exchange Group SYSID';
}

if (match_service_desk) {
    if (task_short_description) {
        task_short_description += ' | ';
        task_assignment_group += ' | ';
    }

    task_short_description += 'Beerus 2';
    task_assignment_group += 'Sys_LRQA_ServiceDesk SYSID';
}
gs.info("Final Output : " + 'match_LRQA_Exchange is ' + match_LRQA_Exchange  + ' match_service_desk is ' + match_service_desk  + ' ' + task_short_description + ' --- ' + task_assignment_group);


Screenshot 2 : 

Subhashisr7_0-1707741284316.png

 


Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.

Warm Regards,
Subhashis r7



Subhashis Ratna
Tera Guru

Hello @rajeshKongamudi,

Have you tried the logic I suggested to fulfill your requirement?

Thanks,
Subhashis