PARTNERS - Please join us for our upcoming webinar:
Leveraging Intelligent Recommendations for Operational Transformation.
AMS Partners click HERE | EMEA/APJ Partners click 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.

Raghu
All-Star
All-Star

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 this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

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
.