Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

CreateAccountJSON - REST Connector for Enabling remote mailbox

samarth
New Contributor II
New Contributor II

V23.9

${user.email} & ${user.customproperty19} are not returning any values when I use them in the following way. Can someone please assist with the right format?

{
"accountIdPath": "accountName",
"responseColsToPropsMap": {},
"call": [{
"name": "call1",
"connection": "acctAuth",
"url": "https://hostname/Saviynt/PS/ExecutePSScript",
"httpMethod": "POST",
"httpParams": "{\"Script\": \"$pass = convertto-securestring -String 'Password#1' -AsPlainText -Force;$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'twdev\\\\SA-Saviynt',$pass;$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri 'http://qwerty.abcd.efgh.net/Powershell/' -Credential $mycred -Authentication Kerberos -AllowRedirection;Import-PSSession -Session $Session -DisableNameChecking -AllowClobber;Enable-RemoteMailbox -Identity \"${user.email}\" -RemoteRoutingAddress \"${user.customproperty19}\" -PrimarySMTPAddress \"${user.email}\"\"}",
"httpHeaders": {
"Authorization": "Basic ________________"
},
"httpContentType": "application/x-www-form-urlencoded",
"SuccessResponses": {
"": ["Success"]
},
"unsuccessResponses": {
"responseMessage": ["\"Failed\"", "\"Powershell script taking too long Sample input: Invoke-Command -ComputerName \\\"SAVIYNTADSVCS\\\" -ScriptBlock {command to execute} -Credential $Cred\""]
}
}]
}

The same JSON works if I hard-code the values instead of ${user.email} and ${user.customproperty19}

Seeing this error: 

{"call1":{"headers":null,"message":{"responseMessage":"\"Exception: Failed error streamCannot process argument transformation on parameter \\u0027PrimarySmtpAddress\\u0027. Cannot convert value \\\"${user.email}\\\" to type \\\"Microsoft.Exchange.Data.SmtpAddress\\\". Error: \\\"You can\\u0027t forward email to \\\"${user.email}\\\" because the address format isn\\u0027t correct. Please enter an email address with this format: user name, the @ sign, followed by the domain name. For example, tonysmith@contoso.com or tony.smith@contoso.com.\\\" System.Exception: Failed error streamCannot process argument transformation on parameter \\u0027PrimarySmtpAddress\\u0027. Cannot convert value \\\"${user.email}\\\" to type \\\"Microsoft.Exchange.Data.SmtpAddress\\\". Error: \\\"You can\\u0027t forward email to \\\"${user.email}\\\" because the address format isn\\u0027t correct. Please enter an email address with this format: user name, the @ sign, followed by the domain name. For example, tonysmith@contoso.com or tony.smith@contoso.com.\\\"\\r\\n at MVC_FIM.Services.PowerShellService.fnExecuteScript(String ScriptName) System.Exception: Failed error streamCannot process argument transformation on parameter \\u0027PrimarySmtpAddress\\u0027. Cannot convert value \\\"${user.email}\\\" to type \\\"Microsoft.Exchange.Data.SmtpAddress\\\". Error: \\\"You can\\u0027t forward email to \\\"${user.email}\\\" because the address format isn\\u0027t correct. Please enter an email address with this format: user name, the @ sign, followed by the domain name. For example, tonysmith@contoso.com or tony.smith@contoso.com.\\\" System.Exception: Failed error streamCannot process argument transformation on parameter \\u0027PrimarySmtpAddress\\u0027. Cannot convert value \\\"${user.email}\\\" to type \\\"Microsoft.Exchange.Data.SmtpAddress\\\". Error: \\\"You can\\u0027t forward email to \\\"${user.email}\\\" because the address format isn\\u0027t correct. Please enter an email address with this format: user name, the @ sign, followed by the domain name. For example, tonysmith@contoso.com or tony.smith@contoso.com.\\\"\\r\\n at MVC_FIM.Services.PowerShellService.fnExecuteScript(String ScriptName)\\r\\n at MVC_FIM.Services.PowerShellService.fnExecuteScript(String ScriptName)\""},"statusCode":500,"description":null,"status":"Failed"}}

[This message has been edited by moderator to merge reply comment content]
1 REPLY 1

SB
Saviynt Employee
Saviynt Employee

Can you try with the unicode value (\u0024) of $ and then validate. 


Regards,
Sahil