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 Account needs to move to a specific OU based on CP value

navneetv
Regular Contributor II
Regular Contributor II

Hi Team,

we have a use case, where we want to achieve if CP40 is updated to '1' then the AD account should be moved to specific OU. I have tried to update the below query in the UpdateAccountJson in the AD connection. However, it gives me errors while updating.  could you please suggest, what query should be added in the Update account JSON so that it moves the account to a specific OU based on CP 40's value?

 

{
"moveUsertoOU": "${if(Users.customproperty40==1){OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com}}"
}

or
{
"moveUsertoOU": "${Users.customproperty40==1}OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com"
}

error message 
Error while Update operation for account-abc.test in AD - Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript274584.groovy: 2: expecting '}', found ',' @ line 2, column 79. ==1){OU=Users location,OU=Test ^ 1 error Error while Update operation for account-abc.test in AD - No such property: Users for class: SimpleTemplateScript274585
11 REPLIES 11

armaanzahir
Valued Contributor
Valued Contributor

@navneetv 

Judging by the error message, it's because the object you're using is incorrect.

Try using user.customproperty40 instead of users.customproperty40

Configuring the Integration for Provisioning and Deprovisioning Accounts (saviyntcloud.com)

Regards,
Md Armaan Zahir

ArvindKumar
New Contributor III
New Contributor III

Hi, 

Can you try this. 

{
"moveUserToOU": "${if(Users.customproperty40==1){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'} else {'OU=other location,OU=Test,DC=Testlab,DC=dev,DC=com'}}"
}

 

Regards, Arvind

SumathiSomala
All-Star
All-Star

@navneetv Try below samples

{
"moveUsertoOU": "${if(user.customproperty40==1){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'}else{'OU=location,OU=Test,DC=Testlab,DC=dev,DC=com'}}"
}

{
"moveUsertoOU": "${if(user.customproperty40.equals('1')){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'}else{'OU=location,OU=Test,DC=Testlab,DC=dev,DC=com'}}"
}

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

CR
Regular Contributor III
Regular Contributor III

@navneetv 

Please can you try below , some time it will expect null check also:

{
"moveUsertoOU": "${if((user.customproperty40!=null) && (user.customproperty40=='1')){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'} else {'OU=location,OU=Test,DC=Testlab,DC=dev,DC=com'}}"
}


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

navneetv
Regular Contributor II
Regular Contributor II

Hi All,

There is more content in updateaccountJSON, which updates another attribute if we use "else" logic then it will move that user to OU, which is mentioned under the else condition, where the CP40 value is 0. because any update happens CP65 ORCP6 or phone number then update account task will be triggered and where if or else , one of them condition will pass. if its 1 then fine but CP40 is 0 then user will be moved to OU=location,OU=Test,DC=Testlab,DC=dev,DC=com, which we don't want 

we want to move the account when cp40 has 1 value. If CP40 is 0 then the account should not be moved 

 

this is my understanding. below is updateAccountJSON which we are using for updating more attributes 

{

"otherLoginWorkstations": "${user.customproperty65}",
"telephoneNumber": "${user.phonenumber}",
"msDS-cloudExtensionAttribute2": "${user.customproperty6}",
"msDS-cloudExtensionAttribute3": "${user.job_function}",
"moveUsertoOU": "${if(user.customproperty40==1){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'}else{'OU=location,OU=Test,DC=Testlab,DC=dev,DC=com'}}"
}

Try below sample

rushikeshvartak_0-1707881874213.png

 


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

CR
Regular Contributor III
Regular Contributor III

@navneetv  correct , it is working? above condition after apply?


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.

navneetv
Regular Contributor II
Regular Contributor II

Hi @CR I am looking at the way where account moves when CP40 is 1 and if it's 0 then the account should not move. Not sure, how to achieve this by using an IF and Else condition.  I got the above query already from the post which was posted by SumathiSomala. 

 

@ArvindKumar How the OU was assigned to the existing users?

is this based on user's field?

 

 

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

bhuvanesh
New Contributor II
New Contributor II

Hi @navneetv 

Please try with below query . If you will not use else even it works . same like below query where IF condition will work for your use case . you don't need to define else condition.

"moveUsertoOU": "${if(user.customproperty40.equals('1')){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'}}

Thanks



CR
Regular Contributor III
Regular Contributor III

@navneetv 

if you dont want if cp40= '0' then you can ignore else condition.

{
"moveUsertoOU": "${if((user.customproperty40!=null) && (user.customproperty40=='1')){'OU=user location,OU=Test,DC=Testlab,DC=dev,DC=com'} }"
}


Thanks,
Raghu
If this reply answered your question, Please Accept As Solution and hit Kudos.