cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misc
Resolver II
Resolver II

Error: Invalid number of arguments. Received 1, expected 0 when trying to trigger automate flow from app

I have a Power Automate which is meant to be triggered by clicking a button in my app. I keep getting an error however which is stopping it from working as it appears to not be able to pick up the 'ThisItem.ID'

 

powerappautomate error.png

The weirdest bit is that I have a previous version on which it was working fine. I can't use this previous version as the live as there have been other fixes made elsewhere in the app which will be a huge pain to have to do again, so I'm just trying to add this icon to the live version now when I get this error. 

 

Screenshot below of the working one on a previous unpublished version of the app so you can see that there is no difference between the two, except that I renamed the automate flow between the two.

powerappautomate working.png

Appreciate any help you might be able to give!

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

@misc 

 

Thanks for sharing more details. The issue here is even though you are passing a value from the app but there is no parameter created on the flow. You need to follow below steps.

 

1) Open the flow and remove the dynamic content from the Get Item Action. Select "Ask in PowerApps" in the dynamic content.

2) Save your flow and remove it from the app.

3) Add the flow again, this time it should accept one parameter, it is still not accepting then you need to repeat step 1-2.

4) Once it is having a parameter, then you can pass FlowName.Run(ThisItem.ID)

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

9 REPLIES 9
BCLS776
Community Champion
Community Champion

It is behaving as though the flow to which you connect needs no arguments. Two things to try:

  1. Check your flow and verify the number of arguments it is expecting
  2. If #1 checks out, disconnect and reconnect the flow to your app to force Power Apps to renew the connection

 

Thanks for coming back to me. I've checked my flow and it definitely only needs one (Get Item). I imagine if that was the issue then the previous version wouldn't work either but it does (I can restore to that version and still get it to run and succeed, if I revert to the 'live' version straight after I get this error again).

 

I have tried renaming the flow, removing it from the data connections, reconnecting it and still no luck. 

 

powerappautomate error2.png

BCLS776
Community Champion
Community Champion

That's starting to sound like a Microsoft Support Ticket kind of problem

yashag2255
Dual Super User II
Dual Super User II

Hi @misc 

 

At times, it is possible when you save the flow and create an input parameter, it creates a reference but is not saved in the flow anywhere. To fix this, you can update the expression as:

 

FlowName.Run(ThisItem.ID, "")

 

Adding an empty input resolves the issue and since the second input is not used anywhere, it just bypasses it. 

 

Note: Please make sure that you are keeping the order right, if you are using parameter 2, then the expression will be FlowName.Run("",ThisItem.ID)

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

I just tried that and it changes the error to: 'Invalid number of arguments: received 2, expected 0'

 

I have input a support ticket as @BCLS776 suggested so hopefully they will be able to come back to me with a solution.

yashag2255
Dual Super User II
Dual Super User II

@misc 

 

If it is saying expected 0, then there is no need to pass anything. The expression will be FlowName.Run()

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

I did try that - and although it ran on the app side I got this error on the Flow:

Unable to process template language expressions in action 'Get_item' inputs at line '1' and column '50392': 'The template language expression 'triggerBody()['Getitem_Id']' cannot be evaluated because property 'Getitem_Id' cannot be selected. 

 

This also doesn't explain why it works with ThisItem.ID on a previous version of the app but not the current one.

yashag2255
Dual Super User II
Dual Super User II

@misc 

 

Thanks for sharing more details. The issue here is even though you are passing a value from the app but there is no parameter created on the flow. You need to follow below steps.

 

1) Open the flow and remove the dynamic content from the Get Item Action. Select "Ask in PowerApps" in the dynamic content.

2) Save your flow and remove it from the app.

3) Add the flow again, this time it should accept one parameter, it is still not accepting then you need to repeat step 1-2.

4) Once it is having a parameter, then you can pass FlowName.Run(ThisItem.ID)

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Thank you so much! That fixed it! 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,987)