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

How to put if else in Create account json

Shwet01
Regular Contributor
Regular Contributor

Hi Folks,

I am performing zoom-saviynt integration. In my create account Json i want to apply if and else condition but its not working, there is some error in my Json which i want to get validated. Can anyone please suggest how to fix this. Did multiple try but everytime i see this payload in logs-

Shwet01_0-1708536612514.png

 

Condition 1-

Saviynt sending zone as Zone north america but zoom application is accepting as NAZ to create zoom account

Condition 2- 

Saviynt sending zone as ZONE ASIA PACIFIC but zoom is accepting as APAC to create zoom account

Create account JSON-

{
"accountIdPath": "call1.message.id",
"dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
"call": [
{
"name": "call1",
"connection": "acctAuth",
"url": "https://xxxxxxxxxxxxxxx/api/zoom-createAccount",
"httpMethod": "POST",
"httpParams": "{\"email\":\"${user.email}\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"zone\":\"${If (user.regioncode=='ZONE ASIA PACIFIC') {'APAC'} elseif (user.regioncode=='Zone north america'){'NAZ'}}\",\"displayName\":\"${user.displayname}\"}",
"httpHeaders": {
"Authorization": "${access_token}",
"x-functions-key": "zzzzzzzzzzzzz"
},
"httpContentType": "application/json",
"successResponses": {
"statusCode": [
201,
200
]
}
}
]
}

Thanks

shweta

4 REPLIES 4

naveenss
All-Star
All-Star

Hi @Shwet01  

Can you please try the below JSON?

{
    "accountIdPath": "call1.message.id",
    "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
    "call": [{
            "name": "call1",
            "connection": "acctAuth",
            "url": "https://xxxxxxxxxxxxxxx/api/zoom-createAccount",
            "httpMethod": "POST",
            "httpParams": "{\"email\":\"${user.email}\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"zone\":\"${(user.regioncode=='ZONE ASIA PACIFIC')?'APAC':((user.regioncode=='Zone north america')?'NAZ')}\",\"displayName\":\"${user.displayname}\"}",
            "httpHeaders": {
                "Authorization": "${access_token}",
                "x-functions-key": "zzzzzzzzzzzzz"
            },
            "httpContentType": "application/json",
            "successResponses": {
                "statusCode": [
                    201,
                    200
                ]
            }
        }
    ]
}

Let me know if this helps!

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

CR
Regular Contributor III
Regular Contributor III

try below

"{\"email\":\"${user.email}\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"zone\":\"${if (user.regioncode=='ZONE ASIA PACIFIC') {'[APAC]'} else if(user.regioncode=='Zone north america'){'[NAZ]'}}\",\"displayName\":\"${user.displayname}\"}",


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

rushikeshvartak
All-Star
All-Star

Below are issues in your json

  • If condtion I is upper case
  • elseif does not have space
{
  "accountIdPath": "call1.message.id",
  "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
  "call": [
    {
      "name": "call1",
      "connection": "acctAuth",
      "url": "https://xxxxxxxxxxxxxxx/api/zoom-createAccount",
      "httpMethod": "POST",
      "httpParams": "{\"email\":\"${user.email}\",\"firstName\":\"${user.firstname}\",\"lastName\":\"${user.lastname}\",\"zone\":\"${if (user.regioncode=='ZONE ASIA PACIFIC') {'[APAC]'} else if(user.regioncode=='Zone north america'){'[NAZ]'}}\",\"displayName\":\"${user.displayname}\"}",
      "httpHeaders": {
        "Authorization": "${access_token}",
        "x-functions-key": "zzzzzzzzzzzzz"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          201,
          200
        ]
      }
    }
  ]
}

 

 


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

@Shwet01 I have tested this as below :

"${if (user.regioncode=='ZONE ASIA PACIFIC') {'[APAC]'} else if(user.regioncode=='Zone north america'){'[NAZ]'}} "

and it worked for us.

Regards
Manish Kumar
If the response answered your query, please Accept As Solution and Kudos
.