A unified Azure platform for creating and managing AI models, agents, and applications with built‑in enterprise security, monitoring, and governance
Hi @Brijdeep Goyal ,
Two pieces are needed here — parsing first, then the condition.
- Parse the JSON into a record (do this before the if/else). The if/else Condition box uses Power Fx, and you can only reference sub-fields (
request.missing_information) ifrequestis a structured record, not a raw JSON string. So make the JSON typed first, either way:
- Recommended – set the agent's output format to a JSON Schema: open the Invoke agent node → Details → the parameter icon → set Text format = JSON Schema, and paste your schema. The agent's saved output then becomes a record you can dot-access.
- Or add a Data transformation → Parse value node to parse the string into a typed value and save it to your
requestvariable.
In your schema, declare the field you want to test as nullable so it can legitimately be absent (Foundry/structured outputs require every property to be required, so emulate "optional" with a null union):
{
"missing_information": { "type": ["string", "null"] }
}
- Write the condition with Power Fx. Local variables need the
Local.scope prefix. To branch on whether the field is missing:
IsBlank(Local.request.missing_information)
- true → the field is missing/blank → route to your "missing" branch.
- To test the opposite (field is present), use:
!IsBlank(Local.request.missing_information)
IsBlank() returns true for blank/null/empty-string, which is exactly the "is this field there?" check. (If you needed to test an array/table field instead, use IsEmpty().)
Common gotchas
- "Name isn't valid" → missing scope prefix. Use
Local.(local vars) orSystem.(system vars). - "Type mismatch" → the value is still a string; parse it first (step 1), or wrap with
Text()/Value(). - Remember to click Save in the visualizer — Foundry doesn't autosave.
Docs:
- Build a workflow in Microsoft Foundry – if/else with Power Fx & Configure a JSON Schema output
- IsBlank / IsEmpty / Coalesce (Power Fx)
- If function (Power Fx)
Hope this unblocks you!
If the answer is helpful, kindly upvote it. If you have extra questions about this answer, please click "Comment".