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

If Else condition in http params with REST connector

rohan32
New Contributor
New Contributor

Hi, We are using the below syntax in the http params of a REST connector but the if else condition is not working - 

 

"httpParams":"${if(user.employeeType.equals('GUEST')) {return '{\"invitedUserEmailAddress\":\"' + user.email + '\",\"invitedUserDisplayName\":\"' + user.displayname + '\", \"invitedUserType\":\"Guest\", \"inviteRedirectUrl\":\"https://myapps.microsoft.com\", \"sendInvitationMessage\":\"true\"}';} else {return '{\"invitedUserEmailAddress\":\"' + user.email + '\",\"invitedUserDisplayName\":\"' + user.email + '\", \"invitedUserType\":\"Guest\", \"inviteRedirectUrl\":\"https://myapps.microsoft.com\", \"sendInvitationMessage\":\"false\"}';}}",

 

The syntax is not working and giving 400 bad request error . Could you please help us with the correct syntax? Ternanry operator also doesn't work inside http params

3 REPLIES 3

rohan32
New Contributor
New Contributor

      "httpParams": "${requestAccessAttributes.addRemoveAlias==null?'{\"name\":{\"familyName\":\"'+user.firstname+'\",\"givenName\":\"'+user.lastname+'\"},\"password\":\"password\",\"primaryEmail\":\"'+account.name+'\",\"orgUnitPath\":\"/\"}':account.customproperty30.toString().contains(requestAccessAttributes.addRemoveAlias)?'{}':'{\"alias\": [\"'+requestAccessAttributes.addRemoveAlias.trim()+'\"]}'}",

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

Manu269
All-Star
All-Star

Can you try this :

      "httpParams": "${requestAccessAttributes.AccesstoCLM ==('Yes')?'{\"user_name\": \"'+user.firstname+'\",\"first_name\": \"'+user.firstname+'\",\"last_name\": \"'+user.lastname+'\",\"email\": \"'+user.email+'\"}':'{\"user_name\": \"'+user.firstname+'\",\"first_name\": \"'+user.firstname+'\"}'}",
Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.