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 Automate flow [P...
Power Apps
Answered

Power Automate flow [PowerApps V2] triggered in PowerApps

(0) ShareShare
ReportReport
Posted on by 82

I have created a flow in Power Automate that is triggered on push of a button in PowerApps. My flow was working perfectly fine until I changed the "Comments" input to optional. Afterwards, I started receiving the following error message. 

Invalid argument type (text). Expecting a record value instead.

 

I am using the formula below in PowerApps, on the OnSelect attribute of a button. The 'Comments input' is currently a html textbox and the ItemID is the selected record ID from a Gallery in my app (Please note: the item ID from the gallery is for a record created and stored in a different SharePoint List called Salary Approval Requests). The comments are optional and are entered at a later date/time, then the record in the Salary Approval Requests SharePoint list. On push of the button, a new record is created in a SharePoint list called "Approval History", showing the time, date, comments, Parent_ID (ItemID from other SharePoint list) and other information regarding the person who pushed the button. 

 

'ApprovalResponses:Approved'.Run(GalleryAllRequests.Selected.ID,RichTextEditor1.HtmlText);

 

Here is my flow:

Aliyah1_1-1689200649496.png

 

How can I make the comments optional, and my flow still run?

 

Categories:
I have the same question (0)
  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hi,
    I would try to create a variable and a condition as a first step after the PowerApps-trigger, to hold the comment if there is one and set an empty string ("") or something like "-" if there is no comment.
    Then reference the "ApproverComment" field to that variable instead of the parameter directly.

  • Aliyah1 Profile Picture
    82 on at

    Hi @Devvj ,

    Can you please elaborate by providing an example?

  • developerAJ Profile Picture
    4,664 on at

    Please provide a screenshot of the error: 

    , I started receiving the following error message. 

    Invalid argument type (text). Expecting a record value instead.

     basically, it says you are passing a record value {somevalue} instead of text.

     

  • Aliyah1 Profile Picture
    82 on at

    Hi @developerAJ,

    Here is a screenshot of the error. The issue is with the HTML textbox in the screenshot, which is the RichTextEditor1.HtmlText textbox in the Run code below.

    'ApprovalResponses:Approved'.Run(GalleryAllRequests.Selected.ID,RichTextEditor1.HtmlText);

    Aliyah1_0-1689229312491.png

     

  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hi,
    Could you try to wrap the RichText in a Text() function, so that it always pass a string (even if the box is not filled in), like this:
    'ApprovalResponses:Approved'.Run(GalleryAllRequests.Selected.ID,Text(RichTextEditor1.HtmlText));

  • Aliyah1 Profile Picture
    82 on at

    Hi @Devvj ,

     

    I originally tried that but the error didn’t go away. 

  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hmm,
    could it be the other value that's the problem?
    Could you try to wrap that one in a Value() funtion? Since it expecting a number in Power Automate?

    'ApprovalResponses:Approved'.Run(Value(GalleryAllRequests.Selected.ID),Text(RichTextEditor1.HtmlText));

  • Aliyah1 Profile Picture
    82 on at

    Hi @Devvj 

     

    Aliyah1_0-1689266931986.png

    I get this error on run, so I think it's just the 2nd value.

    I tried your suggestion just to double check and it created another error. 

    The only change I made was making the field input optional in power automate. I don't really understand how that can make the function fail. 

  • mbarbosa Profile Picture
    146 on at

    Could you share what the parameters expected by your flow are?
    This seems to be the typical case of a mismatch between what you are sending and what the flow is expecting.

    The error appears to indicate that you are passing a text value with the HTMLtext value and the flow is expecting a record type parameter.

  • Aliyah1 Profile Picture
    82 on at

    Hi @mbarbosa,

     

    Is this the information you are looking for? The input should be a text string, as well as the output.

    I started running into issues when I set the comments input as 'optional'. When the input was set to 'required' the flow ran just fine in PowerApps.

     

    Is there a workaround where I can set the default text in the HTML textbox as a blank space, then change the input back to required...that way it appears that there is an input even if there is not?

     

    It wouldn't be ideal, but I'm not sure how to edit the flow in power automate to return " ", if no input is made.

     

    Aliyah1_1-1689268583848.png

     

    Aliyah1_0-1689268503199.png

     

     

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