Get Previous Assigned To member

sp_18
Giga Contributor

Hi,

Here i have to get the previous assigned to member's name who reassigned his ticket to another i.e current assigned to member.

How can i get it?

Dear Insert First Name of Assigned To,

Insert Full Name of the person who re-assigned the ticket has re-assigned this support ticket to you for resolution.

Please find a summary below of the ticket you will need to action.

Thank You.

1 ACCEPTED SOLUTION

Hi Sheetal,



Here is your Final Code:



var gr = new GlideRecord('incident');


gr.addQuery('active', true);


//gr.addQuery('sys_id','2b15abf6db230300e77dd450cf961925'); // Just for testing one incident


gr.query();


if (gr.next()) {


var watch = current.watch_list;


var spl = watch.split(',');


gs.log(spl); //   the code is working till this line


for (var i = 0; i < spl.length; i++) {


var list = spl[i];


gs.log('List '+list);


var usr = new GlideRecord('sys_user');


usr.addQuery('sys_id',list);


usr.query();


if(usr.next())


{


gs.log('First Name '+usr.first_name);


gs.eventQueue('WatchlistAlert',current,usr.first_name,current.watch_list);


}



}



}



Thank you,
Ashutosh Munot



Please Hit Correct, Helpful or like,if you are satisfied with this response.


View solution in original post

15 REPLIES 15

Hi Ashutosh,



this is my code for getting previous assigned to member



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


var previousAssigndTo = previous.assigned_to;


var currentAssigndTo = current.assigned_to;


if(current.assignment_group.changes()&& !(gs.nil(current.assigned_to))){




gs.eventQueue('(PRAC) Get Previous AssignedTo Member',current,previousAssigndTo,current.u_assigned_to);



}


   


})(current, previous);



i want to insert the previous assigned to member's name in email template.



Can you check the code??



Thank you


sp_18
Giga Contributor

Hi all,



i have a business rule where i want to trigger notification only when the count is more than 3 but right now


its triggering for every count.



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


var gaDupCheck1 = new GlideAggregate('incident');


gaDupCheck1.addQuery('active','true');


gaDupCheck1.addAggregate('COUNT', 'u_requestor');


gaDupCheck1.addNotNullQuery('u_requestor');


gaDupCheck1.groupBy('u_requestor');


gaDupCheck1.groupBy('location');


gaDupCheck1.groupBy('category');


gaDupCheck1.groupBy('subcategory');


gaDupCheck1.groupBy('u_subcategory_2');


gaDupCheck1.addHaving('COUNT', '>', 3);


gaDupCheck1.query();


if (gaDupCheck1.next()) {



gs.eventQueue('(SER) Duplicate Incidents',current,'','');


}




})(current, previous);




Can anyone tell me whats the error?


HI,



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


var gaDupCheck1 = new GlideAggregate('incident');


gaDupCheck1.addQuery('active','true');


gaDupCheck1.addAggregate('COUNT', 'u_requestor');


gaDupCheck1.addNotNullQuery('u_requestor');


gaDupCheck1.groupBy('u_requestor');


gaDupCheck1.groupBy('location');


gaDupCheck1.groupBy('category');


gaDupCheck1.groupBy('subcategory');


gaDupCheck1.groupBy('u_subcategory_2');


//gaDupCheck1.addHaving('COUNT', '>', 3);


gaDupCheck1.query();


if (gaDupCheck1.next()) {


var count = agg.getAggregate('COUNT','u_requestor');


if(count >3)


gs.eventQueue('(SER) Duplicate Incidents',current,'','');


}




})(current, previous);



Thanks,


Mark answer helpful.


var count = agg.getAggregate('COUNT','u_requestor');



here in place of agg it should be gaDupCheck1 right??



i need this urgent...!!


Yes you are right as well