add user or group if user is not active in user activity in workflow

dheeru_1994
Tera Contributor
i make workflow on requested item table then i add approval activity in that use user approval activity i select in active user now i want if user is in active then it check and another active user generate approver in requested item table how to fix this issue in servicenow 
Thanks 
 
 
 
3 REPLIES 3

Uncle Rob
Kilo Patron

How do you know what user to select?
Start there.

i make user inactive and that inactive user  i select in user activity 
if i push any other user sys _id and test both approver are comming in requested item table 
and 
i write the script in advance 

answer = [];

function isUserActive(userID) {
    var user = new GlideRecord('sys_user');
    if (user.get(userID)) {
        return user.active == true;
    }
    return false;
}

var selectedUserID = 'a8f98bb0eb32010045e1a5115206fe3a';

if (isUserActive(selectedUserID)) {
    answer.push(selectedUserID);
    gs.info("Selected user is active.");
} else {
    gs.info("Selected user is inactive.");
}
but how the script check that this is active user or not 





OR may i need to achive this by using something else 
i do not know how to fix this issue