Add recruiter to watchlist

HiranamyeeM
Tera Contributor

Hi All !

 

Add the recruiter in the watchlist in HR case table automatically.

 

Wrote a BR, but not working. kindly help !

 

TIA

 

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

var recruiterID = current.u_recruiter.toString();

if (!recruiterID) {
return;
}

var watchList = current.watch_list.toString();

// 3. Add the recruiter to the watchlist if they aren't already on it
if (watchList.indexOf(recruiterID) === -1) {
if (watchList.length > 0) {
current.watch_list = watchList + ',' + recruiterID;
} else {
current.watch_list = recruiterID;
}
}
})(current, previous);

 

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@HiranamyeeM 

so what debugging did you do in your BR?

 

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