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 Automate
Unanswered

Apply to Each Issue

(0) ShareShare
ReportReport
Posted on by 8

Hello. I am having issues trying to create a flow connected with Virtual Agent.

 

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Return_value(s)_to_Power_Virtual_Agents' at line '1 and column '1731' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Return_value(s)_to_Power_Virtual_Agents' to be referenced by 'repeatItems' or 'items' functions.'.'."}}". Code: 0x80060467 InnerError: '.

 

Jimmyqwe_0-1672142108634.pngJimmyqwe_1-1672142153843.png

 

Categories:
I have the same question (0)
  • Verified answer
    Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on at

    Hi @Jimmyqwe 

     

    Current item also returns current value of array which array iterate in apply to each action. and the scope of current item action also only in apply to each action so that's why you have getting error.

     

    If you want to get current item of array you can use Initialize variable outside the apply to each and use append to array variable action inside the apply to each and pass current item value in append to array variable action.

     

    Amit_Sharma_0-1672143456796.png

     

    Amit_Sharma_1-1672143509779.png


    --------------------------------------------------------------------
    If I have answered your question, please mark post as Solved.
    If you like my response, please give it a Thumbs Up.

     

     

       

  • Amit_Sharma Profile Picture
    1,569 Super User 2024 Season 1 on at

    Hi @Jimmyqwe 

     

    Please Confirm the Get item value always return only one value according to your filter if is ok then you don't need to use apply to each you can directly return value to power virtual agent.

  • grantjenkins Profile Picture
    11,063 Moderator on at

    If you knew you were only getting a single value back from SharePoint, you could just move your Return value(s) to Power Virtual Agents into the Apply to each (which will only run once for the single item) and use the output from the Compose.

     

    grantjenkins_0-1672151556799.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • CasualFan Profile Picture
    2 on at

    Thank you, Amit. I still am having issues. The flow will now save but the return I get in virtual agent is only [ ]. Also, based on the filter there will be only one item returned, but in the return to agent value, i do not want all the item data, just a few specific columns.

    CasualFan_0-1672189860729.png

    CasualFan_1-1672189890493.png

    CasualFan_2-1672189906972.png

     

  • Jimmyqwe Profile Picture
    8 on at

    Thanks, I get the following error message.

    Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'InvalidWorkflowRunAction' and message 'The workflow run action 'Return_value(s)_to_Power_Virtual_Agents' has type 'Response' that could not be nested under an action of type 'foreach'.'."}}". Code: 0x80060467 InnerError: '.

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    @JimmyqweSorry, didn't realize it would do that. In that case you can just move your Return value(s) to Power Virtual Agents out of the Apply to each (as you did before) but add the following expression to retrieve the value from your Compose.

     

    first(outputs('Compose'))

     

     

    grantjenkins_0-1672192905801.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

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 Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard