I am trying to create Sales Quote Lines in a Business Central Sales Quote as part of a Power Automate flow. I am using an Dynamic Excel Worksheet for my values and have worked out most of the kinks in my Flow. The last issue I am having is that I am setting a variable for a column in the Excel worksheet titled Quantity via an Apply to Each loop, which is working just fine.
The issue I am now facing is that when I use the Outputs of that variable in a subsequent Apply to Each step (to create my Sales Quote Lines), it is only grabbing the last variable value from the Outputs versus using each one. Previously I had the Apply to Each step within another apply to each step for my HTTP Post sequence, but that was causing duplicate entries as the Apply to Each was in essence running 6 times. See below for where I'm stuck at, is there any possible way to achieve what I'm trying to do?
FYI I'm converting the output of my Quantity variable to an integer in the Post HTTP step "quantity":
Hi @Villanous81 ,
The variable being used here is a string and in the applyToEach, it is updating the same variable and finally ends up having the last value in the Quantity array.
You can consider initializing an array variable instead of just a string and inside the Apply to Each you can use "Append to array variable" action. So that the array contains all values of Quantity.
Thanks and Regards,
Great suggestion, much appreciated. Unfortunately it is now posting the entire array variable whereas I need each number sequentially in the apply to each.