Microsoft Foundry: How does it recognize the different fields of a json schema.

Brijdeep Goyal 0 Reputation points
2026-07-10T07:44:21.5466667+00:00

So I am uploading the Json to agent(Inside workflow) and I want to check if some fields were missing or not in that Json from the user request. now I want to check this using if/else branching but I am unable to write the power function inside the condition block. How can we write the Custom Power Function for this query.
For e.g. I have defined one local variable named "request" and field to check is "missing_information" then how can we write the power query for the same to check if this was present or not in user's input?

Microsoft Foundry
Microsoft Foundry

A unified Azure platform for creating and managing AI models, agents, and applications with built‑in enterprise security, monitoring, and governance


1 answer

Sort by: Most helpful
  1. Thanmayi Godithi 11,545 Reputation points Microsoft External Staff Moderator
    2026-07-11T11:12:05.0566667+00:00

    Hi @Brijdeep Goyal ,

    Two pieces are needed here — parsing first, then the condition.

    1. 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) if request is 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 request variable.

    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"] }
    }
    
    1. 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) or System. (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:

    Hope this unblocks you!

    If the answer is helpful, kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.