Hi, everyone.
I am not very skilled with JSON. My flow sends an HTTP call (that works), then I parse the JSON (that works), then I have an Apply to Each where I use Features to loop and set different variables (the apply to each works, but the expression in one of my variables does not), then I parse JSON again (that doesn't work).
The Expression in my Set Variable
This works:
if(equals(items('Apply_to_each_2')?['attributes']?['POOState'], 'US-CO'), 'Colorado', if(equals(items('Apply_to_each_2')?['attributes']?['POOState'], 'US-TX'), 'Texas'))
But when I stack it up to include more states, it doesn't work:
if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-CO'), 'Colorado', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-TX'), 'Texas', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-MN'), 'Minnesota', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-WI'), 'Wisconsin', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-MI'), 'Michigan', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-ND'), 'North Dakota', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-SD'), 'South Dakota', if(equals(items('Apply to each 2')?['attributes']?['POOState'], 'US-NM'), 'New Mexico'))))))))
The error says "Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The repetition action(s) 'Apply to each 2' referenced by 'inputs' in action 'Set_State_variable' are not defined in the template.'.'."
What am I doing wrong in the expression?
The Parse JSON Error
The 2nd parse JSON action doesn't work, either. I get an error that says "Unable to process template language expressions in action 'Parse_JSON_2' inputs at line '0' and column '0': 'Required property 'content' expects a value but got null. Path ''.'."
Here is my flow:
Then right after that I parse JSON again:
What do I have to do differently in the 2nd Parse JSON action? I really don't know what I'm doing wrong.