I have a flow that triggers when a form is submitted.
I have a .json file with a list of offices and their corresponding property manager's email address.
It looks like this:
{
"139 - Site1": ["ManagerName1", "manager1@email.com"],
"101 - Site2": ["ManagerName2", "manager2@email.com"],
"116 - site3": ["ManagerName3", "manager3@email.com"],
"153 - site3": ["ManagerName4", "manager4@email.com"]
...
}
I can get the JSON key (e.g., "139 - Site1") from an AD field from an employee who submits the form. I want to use that key to parse the JSON object and get back the array containing ["ManagerName1", "manager1@email.com"] and use it to email the manager.
Here are the relevant actions I have set up:
- When a new response is submitted
- Get user profile (V2)
- Get file content using path
- Parse JSON
- Compose
- Send Email Notification
I'm using a compose action with an input of @outputs('Parse_JSON')?['body']?[SITENAME]
This flow works flawlessly when I manually input the SITENAME with a string like so: @outputs('Parse_JSON')?['body']?['139 - Site1']
However, when I try to use the string from the Get user profile (V2) action, I get an error message complaining that the Compose action contains an invalid expression.
@outputs('Parse_JSON')?['body']?[/OfficeLocation] (the /OfficeLocation is dynamic content from the Get user profile (V2) action).
It seems like it's impossible to use dynamic content in a Compose action like this.
Has anyone done something similar before?
Any advice for working around this limitation? If there's a better way to do the same thing, I'm all ears.
Thanks.