Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

AD disable account with if else condition

SumathiSomala
All-Star
All-Star

Hi team ,

we have requirement for AD when user account is disabled account should move to different OUs as per condition.

user update rules are getting triggered disable account tasks are created.

when i run wsretry job, pending task is not moving.

but account is getting disabled in  AD.

Move user to OU not working.

 

DISABLEACCOUNTJSON:

{
"deleteAllGroups":"No",
"userAccountControl":"514",
"moveUsertoOU":"${if (user.customproperty40=='LOA'){'OU=LOA,OU=XX Users,DC=XX,DC=LOCAL'}else if(user.statuskey==0){'OU=Disable Accounts,OU=XX Users,DC=XX,DC=LOCAL'}else{'OU=On Hold User Accounts,OU=XX Users,DC=XX,DC=LOCAL'}}",
"password": "${randomPassword}"
}

Error in pending task:

SumathiSomala_0-1692437256212.png

 

Any help would be appreciated

.

 

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.
16 REPLIES 16

pmahalle
All-Star
All-Star

Hi @SumathiSomala ,

Any reason you are passing password while disabling the account. Can you try removing it?


Pandharinath Mahalle(Paddy)
If this reply answered your question, please Accept As Solution to help other who may have a same problem. Give Kudos 🙂

rushikeshvartak
All-Star
All-Star

LDAP Error Codes Document - https://docs.servicenow.com/en-US/bundle/vancouver-platform-security/page/administer/reference-pages...

LDAP: error code 80 - The password provided by the user did not match any password(s) stored in the user's entry Worker . 

{
"deleteAllGroups":"No",
"userAccountControl":"514",
"moveUsertoOU":"${if(user.customproperty40.equals('LOA')){'OU=LOA,OU=XXXX Users,DC=XXXX,DC=LOCAL'}else if(user.statuskey==0){'OU=Disable Accounts,OU=XXXX Users,DC=XXXX,DC=LOCAL'}else{'OU=On Hold User Accounts,OU=XXXX Users,DC=XXXX,DC=LOCAL'}}"
}

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

SumathiSomala
All-Star
All-Star

Thanks @pmahalle and @rushikeshvartak ,

Tried with and without passing password no luck.

Already we tested only else condition is working as expected.

when if or else if condition true move OU not working and pending tasks are stuck in queue.

SumathiSomala_0-1692508938227.png

Attaching the logs.

Any other inputs?

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

{
  "deleteAllGroups": "No",
  "userAccountControl": "514",
  "moveUsertoOU": "${if (task?.userKey?.customproperty40=='LOA'){'OU=LOA,OU=XX Users,DC=XX,DC=LOCAL'}else if(task?.userKey?.statusKey==0){'OU=Disable Accounts,OU=XX Users,DC=XX,DC=LOCAL'}else{'OU=On Hold User Accounts,OU=XX Users,DC=XX,DC=LOCAL'}}"
}

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Tried @rushikeshvartak 

No luck .

Account status is changed to 66048 in AD and move OU not working and pending tasks are stuck in queue.

SumathiSomala_0-1692515071652.png

 

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

Does user have customproperty set ?


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

SumathiSomala
All-Star
All-Star

Yes @rushikeshvartak 

User update rule set  to disable account in AD and then set user customproperty 40 .

Disable account tasks created .

Ran the provisioning job 

User account disabled in AD and Move OU not happening and pending tasks stuck on Q.

Any idea?

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

"moveUsertoOU":"${if(user.customproperty40.equalsIgnoreCase('LOA')){'OU=LOA,OU=XXXX Users,DC=XXXX,DC=LOCAL'}else if(user.statuskey==0){'OU=Disable Accounts,OU=XXXX Users,DC=XXXX,DC=LOCAL'}else{'OU=On Hold User Accounts,OU=XXXX Users,DC=XXXX,DC=LOCAL'}}"

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Tried @rushikeshvartak ,

No luck this time account is also active in AD.

Also tried with different CP and value

Is there any other configurations/customization required to perfom disable account.

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

user.customproperty40.equalsIgnoreCase('LOA')
? 'OU=LOA,OU=XXXX Users,DC=XXXX,DC=LOCAL'
: (user.statuskey == 0
? 'OU=Disable Accounts,OU=XXXX Users,DC=XXXX,DC=LOCAL'
: 'OU=On Hold User Accounts,OU=XXXX Users,DC=XXXX,DC=LOCAL')


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

@rushikeshvartak 

can u help with complete JSON

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

SumathiSomala
All-Star
All-Star

Tried @rushikeshvartak ,

Still luck.

Will raise fresh desk ticket

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

ruqayyah
Saviynt Employee
Saviynt Employee

@SumathiSomala 

Please try the below  json and let us know if that helps.

ruqayyah_1-1692631924893.png

Regards

Ruqayyah

SumathiSomala
All-Star
All-Star

Thanks @ruqayyah 

Already tried not working

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

Hi team,

Any other inputs ?

still we are unable to perform moveusertoOU

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.

SumathiSomala
All-Star
All-Star

Thanks all tried all suggestion shared.it didn't work. So I have configured user update rule to disable the account and update AD account to move user to different OU.

Regards,
Sumathi Somala
If this reply answered your question, please Accept As Solution and give Kudos.