Click HERE to see how Saviynt Intelligence is transforming the industry. |
10/09/2023 06:47 AM - edited 10/09/2023 06:49 AM
Hi All,
We are trying to push "phonenumber" to AD if available in Saviynt and if it is not available, it should not be pushed. We are using the below configuration/code in CREATEACCOUNTJSON and UPDATEACCOUNTJSON to achieve the same:
"telephoneNumber": "${if(user.phonenumber != null){user.phonenumber}}",
the issue here is that in case of update Account tasks, if the phone number is null in Saviynt, it removes the existing phone number value in AD as we are not handling else case in the above code.
We have tried below conditions as well but it did not work:
"telephoneNumber": "${if(user.phonenumber != null){user.phonenumber} else {SAVIYNTNOTCHANGED}}",
"telephoneNumber": "${if(user.phonenumber != null){user.phonenumber} else {undefined}}",
Getting below error when using above logic:
Error while Update operation for account-XYZ in AD - No such property: SAVIYNTNOTCHANGED for class: SimpleTemplateScript9486
Can you please help here to handle this scenario?
Ideally, It should update phone number in AD if available in Saviynt. however, it should not change/clear existing phone number in AD, if phone number is not available in Saviynt.
Regards
Ankit
10/09/2023 08:32 AM
@dubeank : Try below assuming you have other mappings before and after this mapping hence added comma(,) at start and end. If not accordingly change it.
"${if(user.phonenumber != null){',"telephoneNumber": ' + user.phonenumber +','}}"
10/10/2023 03:00 AM
@Saathvik : Thank you so much for your quick response.
I have tried the above logic and I am getting a JSON Parse error. Please find below the UpdateAccountJSON code:
{
"cn": "${task.accountName}",
"userAccountControl": "512",
"name": "${task.accountName}",
"sn": "${user.lastname}${if(user.employeeType.equals('External')){'(EXT)'} else {''}}",
"givenName": "${if(user.customproperty11 != null) {user.customproperty11} else {user.firstname}}",
"displayName": "${if(user.customproperty11 != null) {user.customproperty11} else{user.firstname}} ${user.lastname} ${if(user.employeeType.equals('External')){'(EXT)'} else{''}}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
],
"samaccountname": "${task.accountName}",
"manager": "${if(user.manager != null && managerAccount != null && managerAccount.accountID != null){managerAccount.customproperty26 }}",
"${if(user.phonenumber != null){',"telephoneNumber": ' + user.phonenumber +','}}",
"c": "${if(user.customproperty6 != null){user.customproperty6}}",
"co": "${if(user.country != null){user.country}}",
"title": "${if(user.job_function != null){user.job_function}}",
"department": "${user.departmentname}",
"departmentNumber": "${user.departmentNumber}",
"extensionAttribute1": "${if(user.costcenter != null){user.costcenter}}",
"extensionAttribute2": "${if(user.customproperty16 != null){user.customproperty16}}",
"st": "${if(user.state != null){user.state}}",
"l": "${if(user.location != null){user.location}}",
"company": "${if(user.companyname!= null){user.companyname}}",
"countrycode": "${if(user.customproperty8 != null){user.customproperty8}}",
"postalCode": "${if(user.customproperty5 != null){user.customproperty5}}",
"streetAddress": "${if(user.street != null){user.street}}",
"scriptPath": "LogonScripts\\gls_logonscript_universal.vbs",
"employeeID": "${user.customproperty14}",
"physicalDeliveryOfficeName": "${if(user.employeeType.equals('External')){'External'} else if(user.customproperty7 != null){user.customproperty7}}"
}
I have also tried :
"${if(user.phonenumber != null){"telephoneNumber":user.phonenumber}}",
but getting JSON Parsing error.
Could you please help me to fix the parsing error.
Regards
Ankit
10/10/2023 04:59 AM
@dubeank Could you please try with below mappings
"telephoneNumber": "${if(user.phonenumber != null){user.phonenumber} else {'SAVIYNTNOTCHANGED'}}",
"telephoneNumber": "${if(user.phonenumber != null?user.phonenumber:'SAVIYNTNOTCHANGED'}",
10/10/2023 06:26 AM
@SumathiSomala : Thanks for your suggestion.
We tried the mapping mentioned above and if "phonenumber" is null then it's Pushing 'SAVIYNTNOTCHANGED' value to AD as we are passing it as String.
It seems that this option does not work for AD and we have to pass SAVIYNTNOTCHANGED without ''.
Ref: https://forums.saviynt.com/t5/identity-governance/dont-provision-a-specific-attribute-if-dynamic-att...
Regards
Ankit
10/10/2023 05:25 AM - edited 10/10/2023 05:25 AM
@dubeank : Try below
{
"cn": "${task.accountName}",
"userAccountControl": "512",
"name": "${task.accountName}",
"sn": "${user.lastname}${if(user.employeeType.equals('External')){'(EXT)'} else {''}}",
"givenName": "${if(user.customproperty11 != null) {user.customproperty11} else {user.firstname}}",
"displayName": "${if(user.customproperty11 != null) {user.customproperty11} else{user.firstname}} ${user.lastname} ${if(user.employeeType.equals('External')){'(EXT)'} else{''}}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
],
"samaccountname": "${task.accountName}",
"manager": "${if(user.manager != null && managerAccount != null && managerAccount.accountID != null){managerAccount.customproperty26 }}",
"c": "${if(user.customproperty6 != null){user.customproperty6}}",
"co": "${if(user.country != null){user.country}}",
"title": "${if(user.job_function != null){user.job_function}}",
"department": "${user.departmentname}",
"departmentNumber": "${user.departmentNumber}",
"extensionAttribute1": "${if(user.costcenter != null){user.costcenter}}",
"extensionAttribute2": "${if(user.customproperty16 != null){user.customproperty16}}",
"st": "${if(user.state != null){user.state}}",
"l": "${if(user.location != null){user.location}}",
"company": "${if(user.companyname!= null){user.companyname}}",
"countrycode": "${if(user.customproperty8 != null){user.customproperty8}}",
"postalCode": "${if(user.customproperty5 != null){user.customproperty5}}",
"streetAddress": "${if(user.street != null){user.street}}",
"scriptPath": "LogonScripts\\gls_logonscript_universal.vbs",
"employeeID": "${user.customproperty14}",
"physicalDeliveryOfficeName": "${if(user.employeeType.equals('External')){'External'} else if(user.customproperty7 != null){user.customproperty7}}"
"${if(user.phonenumber != null){',\"telephoneNumber\": ' + user.phonenumber}}"
}
10/10/2023 05:51 AM
@Saathvik : Hi SK,
I have tried the above and getting again JSON Parse error.
I have checked the logs and it's showing below error:
The attribute key name ' "telephoneNumber" : ' is missing and just the attribute value is showing as null.
Thanks in advance for your help.
Regards
Ankit
10/10/2023 10:31 AM
@dubeank : Cool that logs help, Try below
{
"cn": "${task.accountName}",
"userAccountControl": "512",
"name": "${task.accountName}",
"sn": "${user.lastname}${if(user.employeeType.equals('External')){'(EXT)'} else {''}}",
"givenName": "${if(user.customproperty11 != null) {user.customproperty11} else {user.firstname}}",
"displayName": "${if(user.customproperty11 != null) {user.customproperty11} else{user.firstname}} ${user.lastname} ${if(user.employeeType.equals('External')){'(EXT)'} else{''}}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
],
"samaccountname": "${task.accountName}",
"manager": "${if(user.manager != null && managerAccount != null && managerAccount.accountID != null){managerAccount.customproperty26 }}",
"c": "${if(user.customproperty6 != null){user.customproperty6}}",
"co": "${if(user.country != null){user.country}}",
"title": "${if(user.job_function != null){user.job_function}}",
"department": "${user.departmentname}",
"departmentNumber": "${user.departmentNumber}",
"extensionAttribute1": "${if(user.costcenter != null){user.costcenter}}",
"extensionAttribute2": "${if(user.customproperty16 != null){user.customproperty16}}",
"st": "${if(user.state != null){user.state}}",
"l": "${if(user.location != null){user.location}}",
"company": "${if(user.companyname!= null){user.companyname}}",
"countrycode": "${if(user.customproperty8 != null){user.customproperty8}}",
"postalCode": "${if(user.customproperty5 != null){user.customproperty5}}",
"streetAddress": "${if(user.street != null){user.street}}",
"scriptPath": "LogonScripts\\gls_logonscript_universal.vbs",
"employeeID": "${user.customproperty14}",
"physicalDeliveryOfficeName": "${if(user.employeeType.equals('External')){'External'} else if(user.customproperty7 != null){user.customproperty7}}"
"${if(user.phonenumber != null){',\"telephoneNumber\": ' + user.phonenumber} else{''}}"
}
10/12/2023 04:50 AM
@Saathvik : Thank you so much for your help.
I used the above configuration but it did not work.
When i am passing null value for phone number, it's giving below error:
and when passsing some value for phonenumber, getting below error:
I have also tried online json formatter and validator and it's showing error.
can you please check once again and help here to resolve the issue.
your help is highly appreciated.
Regards
Ankit
10/12/2023 05:07 AM
@dubeank Could you please try below JSON
{
"cn": "${task.accountName}",
"userAccountControl": "512",
"name": "${task.accountName}",
"sn": "${user.lastname}${if(user.employeeType.equals('External')){'(EXT)'} else {''}}",
"givenName": "${if(user.customproperty11 != null) {user.customproperty11} else {user.firstname}}",
"displayName": "${if(user.customproperty11 != null) {user.customproperty11} else{user.firstname}} ${user.lastname} ${if(user.employeeType.equals('External')){'(EXT)'} else{''}}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
],
"samaccountname": "${task.accountName}",
"manager": "${if(user.manager != null && managerAccount != null && managerAccount.accountID != null){managerAccount.customproperty26 }}",
"c": "${if(user.customproperty6 != null){user.customproperty6}}",
"co": "${if(user.country != null){user.country}}",
"title": "${if(user.job_function != null){user.job_function}}",
"department": "${user.departmentname}",
"departmentNumber": "${user.departmentNumber}",
"extensionAttribute1": "${if(user.costcenter != null){user.costcenter}}",
"extensionAttribute2": "${if(user.customproperty16 != null){user.customproperty16}}",
"st": "${if(user.state != null){user.state}}",
"l": "${if(user.location != null){user.location}}",
"company": "${if(user.companyname!= null){user.companyname}}",
"countrycode": "${if(user.customproperty8 != null){user.customproperty8}}",
"postalCode": "${if(user.customproperty5 != null){user.customproperty5}}",
"streetAddress": "${if(user.street != null){user.street}}",
"scriptPath": "LogonScripts\\gls_logonscript_universal.vbs",
"employeeID": "${user.customproperty14}",
"physicalDeliveryOfficeName": "${if(user.employeeType.equals('External')){'External'} else if(user.customproperty7 != null){user.customproperty7}}",
"telephoneNumber": "${if(user.phonenumber!=null){user.phonenumber} else{''}}"
}
10/12/2023 05:29 AM
@SumathiSomala : Hi Somathi,
When I am using the code you provided, I am not getting a parsing error. the task is getting completed sucessfully. however, if the phone number value is null in Saviynt. it's deleting existing phone number value from AD. which we don't want.
Thanks
Ankit
10/12/2023 05:41 AM - edited 10/16/2023 01:23 AM
@dubeank Could you please check the below config in AD connection parameters
Now try below sample mappings
"telephoneNumber": "${user.phonenumber}"
"telephoneNumber": "${if(user.phonenumber!=null){user.phonenumber} else{''}}"
Let me know if it helps.
If this reply answered your question, please Accept it As Solution to help others who may have a similar problem.
10/16/2023 01:23 AM
@dubeank Are you still facing the issue?
10/16/2023 02:25 AM - last edited on 10/16/2023 03:40 AM by Sunil
@SumathiSomala : Apologies for the delay in response.
I have checked it after setting SUPPORTEMPTYSTRING=TRUE and noticed that if we are setting this configuration then Saviynt is allowing to push NULL value to AD.
AS you can see in the above screenshot, value of phone number is updated to NULL in AD.
I have also checked documentation portal and i found below:
and it seems that it is working in opposite way.
Unfortunatly, this did not resolve my use case.
I want to push to AD if and only if some value is there and if phone number is null it should not be pushed.
can you suggest if we can push value based on some other condition. like: if country=NL then only phone number attribute should be passed to AD else it should not be included into create account/Update Account JSON.
Regards
Ankit
10/17/2023 12:29 AM
@rushikeshvartak , @dgandhi , @pmahalle :
can you please check if we can handle this use case in any way?
Regards
Ankit