web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps Flow Trigge...
Power Apps
Suggested Answer

Power Apps Flow Trigger Error: Expected String but got Null

(0) ShareShare
ReportReport
Posted on by 6

I'm trying to trigger a flow from a button in my Power App, but I keep getting the following error:

 
{
  "error": {
    "code": "TriggerInputSchemaMismatch",
    "message": "The input body for trigger 'manual' of type 'Request' did not match its schema definition. Error details: 'Invalid type. Expected String but got Null.'"
  }
}
 

The attachment field is optional, but even when no file is uploaded, this error still occurs.

 

Here is the code behind the button:

 

 

// Call the flow and store the result
Set(
    varResult;
    'Arbeidsrecht:Uitspraak'.Run(
        Coalesce(TextInput1.Text; ""); // required field
        {
            text_1: If(IsBlank(TextInput2.Text); ""; TextInput2.Text);
            text_2: If(IsBlank(TextInput3.Text); ""; TextInput3.Text);
            file: If(
                CountRows(BijlageVeld1.Attachments) = 0;
                {
                    name: "geen_bijlage.txt";
                    contentBytes: ""
                };
                {
                    name: Coalesce(Last(BijlageVeld1.Attachments).Name; "");
                    contentBytes: Coalesce(Last(BijlageVeld1.Attachments).Value; "")
                }
            )
        }
    )
);

// If a result is returned, reset the input fields
If(
    !IsBlank(varResult);
    Reset(TextInput1);
    Reset(TextInput2);
    Reset(TextInput3);
    Reset(BijlageVeld1)
)

 

 

What could be causing this error, and how can I ensure the flow accepts the input correctly even when no attachment is provided? With the help of ChatGPT I tried about 100 different formula's and none of the work.

Tnx!
Categories:
I have the same question (0)
  • Suggested answer
    StretchFredrik Profile Picture
    3,395 Super User 2025 Season 2 on at
    Hello,
     
    can you try the below code, and see if it makes a difference?
     
    Set(
        varResult;
        'Arbeidsrecht:Uitspraak'.Run(
            Coalesce(TextInput1.Text; Text("")); // required field
            {
                text_1: If(IsBlank(TextInput2.Text); Text(""); TextInput2.Text);
                text_2: If(IsBlank(TextInput3.Text); Text(""); TextInput3.Text);
                file: If(
                    CountRows(BijlageVeld1.Attachments) = 0;
                    {
                        name: "geen_bijlage.txt";
                        contentBytes: Text("")
                    };
                    {
                        name: Coalesce(Last(BijlageVeld1.Attachments).Name; Text(""));
                        contentBytes: Coalesce(Last(BijlageVeld1.Attachments).Value; Text(""))
                    }
                )
            }
        )
    );
     
     
    If my response solved your issue, please mark it as ✅ Accepted Answer and give it a like.
  • MV-09090656-0 Profile Picture
    6 on at

    Thank you for your reply. No it doesn't work. The code doesn't give an error, but the send button just doesn't work without attachment. If I add an attachment it does work.
  • Power Platform 1919 Profile Picture
    1,894 on at
    Hi @MV-09090656-0,
    Can you share the screenshot of the Power Automate flow trigger?
    and can you check is the Field marked as optional?
    click on Peek Code:
    check for required field:
     
    if required is [] means it is not expecting any required input
  • MV-09090656-0 Profile Picture
    6 on at
    @Power Apps 1919

    Thank you for your response.
     
    It is optional. Only the first field is mandatory.
     
     
    The code:
     
    {
        "kind""PowerAppV2",
        "inputs": {
            "schema": {
                "type""object",
                "properties": {
                    "text": {
                        "title""Uitspraak",
                        "type""string",
                        "x-ms-dynamically-added"true,
                        "description""Please enter your input",
                        "x-ms-content-hint""TEXT"
                    },
                    "text_1": {
                        "title""Opmerkingen",
                        "type""string",
                        "x-ms-dynamically-added"true,
                        "description""Please enter your input",
                        "x-ms-content-hint""TEXT"
                    },
                    "text_2": {
                        "title""Link",
                        "type""string",
                        "x-ms-dynamically-added"true,
                        "description""Please enter your input",
                        "x-ms-content-hint""TEXT"
                    },
                    "file": {
                        "title""Bijlage",
                        "type""object",
                        "x-ms-dynamically-added"true,
                        "description""Please select file or image",
                        "x-ms-content-hint""FILE",
                        "properties": {
                            "name": {
                                "type""string"
                            },
                            "contentBytes": {
                                "type""string",
                                "format""byte"
                            }
                        }
                    }
                },
                "required": [
                    "text"
                ]
            }
        },
        "metadata": {
  • Suggested answer
    Power Platform 1919 Profile Picture
    1,894 on at
    Update 2:
    When you have to send Optional Attachments , try the formula in this format. (Sample Call)
    Attachment_Upload_Test.Run(
        If(
            CountRows(Attachments.Attachments) > 0,
            {
                file: With(
                    {File_c: First(Attachments.Attachments)},
                    {
                        name: File_c.Name,
                        contentBytes: File_c.Value
                    }
                )
            },
            Blank()
        )
    )
     
  • MV-09090656-0 Profile Picture
    6 on at
    @Power Apps 1919 Thanks, but that doens't work either. It is a different message however. Instead of missing string, it now says: "Expected object but got Null."
  • Power Platform 1919 Profile Picture
    1,894 on at
    Hi @MV-09090656-0,
    Sorry for the late follow up, can you please share where you are getting the error , is it in the trigger or any other action.

    in my case: 
    i tried this . ( this is required as you cant send null to the create file action).
    Pics:
    Condition : 
    empty(triggerBody()?['file']?['contentBytes'])

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard