workflow user activity check code

dheeru_1994
Tera Contributor

Hi all  i have written this code in user activity if requester is inactive user so on the basis of inactive user i am running this code but only else part run that user is not found where i am doing mistake

 
var answer = []; var requested = current.variables.requested_name.getDisplayValue(); gs.info("Requester name is: " + requested); var grRequester = new GlideRecord('sys_user'); grRequester.addQuery('user_name', requested); grRequester.query(); if (grRequester.next()) { if (!grRequester.active) { var grActive = new GlideRecord('sys_user'); grActive.addQuery('active', true); grActive.query(); if (grActive.next()) { answer.push(grActive.sys_id); gs.info("The active approver is: " + grActive.sys_id); } else { gs.error("No active users found for approver."); } } else { gs.info("Requested user is active, no approver needed."); } } else { gs.error("Requested user not found."); }

Note after requesting item and select requester user no approver generate in logs    this message come 
this message populate in logs user not found 
where i am doing mistake 

9 REPLIES 9

in this code i am not abel to generate approver where i am doing mistake here 

forget the code for now, tell me what is the goal, what are you trying to implement?

-Anurag

okay i have requirement   in catalog item  if requester is inactive user then by using of workflow  another active user should generate approver  it should achive only by using workflow 

How can the requestor be inactive? How can an inactive user log in and request something?

 

Also if requestor is inactive, how does that impact approver? Approver doesn't depend on this.

-Anurag

i make user inactive in user table and i make variable that that is refrence type and i take user table as a refrence  then i connect workflow