Azure Logic App JSON Array Data Operation

Copper Contributor

We have a scenario where we are getting an JSON array response from Hubspot webhook Ex-

clipboard_image_0.png

this JSON array may have length upto 40 or 50.

 

Now I want to check

if 'subscriptionType' contains 'company' then set variable 'Iscompany' to 'true'

else If 'subscriptionType' contains 'contact' then set variable 'Iscontact' to 'true'

else if 'subscriptionType' contains 'company' and 'contact' then set variable 'Iscompany' and 'Iscontact' to 'true'.  Example-

clipboard_image_1.png

 

Now the problem is this - suppose if there is length of JSON array is 40 or 50 and we got our variables 'IsContact' and 'IsCompany' is set to 'True' in its first 2 or 3 iterations so why do i check in full array?

 

Is there any alternate way to achieve this logic- 

if 'subscriptionType' contains 'company' then set variable 'Iscompany' to 'true'

else If 'subscriptionType' contains 'contact' then set variable 'Iscontact' to 'true'

else if 'subscriptionType' contains 'company' and 'contact' then set variable 'Iscompany' and 'Iscontact'.

 

like if JSON Body contains 'company' or 'contact' as value of keys then set variables to true or false.

 

0 Replies