Click HERE to see how Saviynt Intelligence is transforming the industry. |
06/30/2023 09:42 AM
Hi,
Could you please help me correct how to execute the following if the condition is met call MPCExchangeDisplay.ps1 else MPCExchangehide.ps1.
"httpParams": "{\"Script\":\"${if(user.customproperty58 == NULL) {Powershell.exe -File D:/test/MPCExchangeDisplay.ps1 {user.username} {connection.PS_Password}} else {Powershell.exe -File D:/test/MPCExchangehide.ps1 {user.username} {connection.PS_Password}}}\"}",
LOGS:
2023-06-30 16:06:20,413 [quartzScheduler_Worker-1] DEBUG rest.RestProvisioningService - Calling Webservice Url - https://zzzzz/SaviyntApp/PS/ExecutePSScript with httpParams - [Script:${if(user.customproperty58 == NULL) {Powershell.exe -File D:/test/MPCExchangeDisplay.ps1 {user.username} {connection.PS_Password}} else {Powershell.exe -File D:/test/MPCExchangeDisplay.ps1 {user.username} {connection.PS_Password}}}]
The task is getting completed but the script is not getting executed at all.
Do we have to define the if else out side the script block? Or can we make two separate calls based on the condition?
Alternatively if this not feasible is there a way to import exchange users based on the REST connector? I need to have exchange accounts in a deleted status if the user is re-hired for a create account to be triggered again.
Thanks,
Umang
07/02/2023 09:39 PM
Did you refer this syntax:
How to support If Else condition in Connector JSON - Saviynt Forums - 39500
Solved: Rest Connector Create Account JSON - IF/Else using... - Saviynt Forums - 25802
Solved: If-else condition in REST connection - Saviynt Forums - 2943
Solved: Syntax for If- else condition in REST connector fe... - Saviynt Forums - 30502
07/03/2023 10:25 AM
I tried a couple of ways:
"httpParams": "${user.customproperty58.trim().equals('User Mailbox Triggered')?'{\"Script\":\"Powershell.exe -File D:\/test\/MPCExchangeProvisioning.ps1'+user.username+''+connection.PS_Password+'\"}' : '{\"Script\":\"Powershell.exe -File D:\/test\/MPCExchangeProvisioning.ps1'+user.username+''+connection.PS_Password+'\"}'}",
"httpParams": "${user.customproperty58 == 'User Mailbox Triggered' ? [{\"Script\":\"Powershell.exe -File D:\/test\/MPCExchangeProvisioning.ps1 '${user.username}' '${connection.PS_Password}' \"}] : [{\"Script\":\"Powershell.exe -File D:\/test\/MPCExchangeDisplay.ps1 '${user.username}' '${connection.PS_Password}' \"}]}",
But getting the following error:
2023-07-03 17:19:06,995 [quartzScheduler_Worker-4] ERROR rest.RestProvisioningService - Exception in creating original http params:com.fasterxml.jackson.core.JsonParseException: Unrecognized token '$': was expecting ('true', 'false' or 'null')
at [Source: ${user.customproperty58.trim().equals('User Mailbox Triggered')?'{"Script":"Powershell.exe -File D:/test/MPCExchangeProvisioning.ps1'+user.username+''+connection.PS_Password+'"}' : '{"Script":"Powershell.exe -File D:/test/MPCExchangeProvisioning.ps1'+user.username+''+connection.PS_Password+'"}'}; line: 1, column: 2]
07/03/2023 08:45 PM
Try syntax from below example 6
https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm