cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Cripp88
Level: Powered On

Invoke ForAll at OnSuccess

Is it possible to use ForAll in the OnSuccess property of an edit form? I can't see any documentation that you can't, but I have run a lot of tests today after coming up against this issue and it seems to not be possible.

 

My scenario is:

 

  • A user fills out the form and selects one or multiple items from a combo box.
  • The form is submitted and is written to the data source (SharePoint).
  • On successful submit, the combobox selected items are iterated using ForAll.
  • For each selected item, it is patched to a different table to the main submission.
  • These records are linked to the main submission with LastSubmit.ID.

However anything I put within the ForAll isn;t working. I have tried:

 

  • Copying the Patch code to outside the ForAll (works fine).
  • Adding a Collect(Test, Result) to the ForAll (is blank after running).

So I am at a loose end! I can't put the patches in with the submit button as I need the LastSubmit ID to link the records in the datasource.

 

Can anyone run this on their end to see if it can be reporduced, or suggest a workaround that satisfies my requirements?

1 ACCEPTED SOLUTION

Accepted Solutions
Cripp88
Level: Powered On

Re: Invoke ForAll at OnSuccess

Thanks @v-xida-msft , I'm not using Choice-type columns in SharePoint, just single line text.

 

I actually solved it (I think). What I think was the issue is that referencing the SelectedItems property of ComboBoxes that sit within datacards in the form wasn't possible. While I made sure that I hadn't called ResetForm/NewForm until after the ForAll code, I think the ComboBoxes weren't accessible at the moment that the code ran.

 

I got around this by adding the selected items to collections when the submit button is pressed, then iterating these using ForAll.

View solution in original post

6 REPLIES 6
lucia
Level 8

Re: Invoke ForAll at OnSuccess

So I am at a loose end! I can't put the patches in with the submit button as I need the LastSubmit ID to link the records in the datasource.

 

Hey,

 

you can use last submitted ID, you just have to use it after you submit the form command.

 

Hope this helps.

Cripp88
Level: Powered On

Re: Invoke ForAll at OnSuccess

I know, but can I use ForAll & Patch within OnSuccess of the form?

lucia
Level 8

Re: Invoke ForAll at OnSuccess

Community Support Team
Community Support Team

Re: Invoke ForAll at OnSuccess

Hi @Cripp88 ,

Could you please share a bit more about the ForAll formula you typed within your app?

Which type column do you use to store the ComboBox selected values? Choice type column with the "Allow Multiple Selections" enabled?

 

Based on the needs you mentioned, I think the ForAll function and Patch function could be used within the OnSuccess property of the Edit form.

 

I have made a test on my side, please take a try with the following workaround:

Set the OnSuccess property of the Edit form to following:

ForAll(
          EditForm1.LastSubmit.ChoiceColumn,     /* <-- ChoiceColumn represents the Choice type column in your Main SP list, which used to store the ComboBox selected values */
          Patch(
                    'YourDifferentTable',
                     Patch('YourDifferentTable'),
                     {
                        Column1: EditForm1.LastSubmit.ID,
                        Column2: Value
                     }
          )
)

Note: The Column1 and Column2 represents the columns in your Different Table. The Column1 is used to store the ID value, the Column2 is used to store each selected item within the ComboBox.

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cripp88
Level: Powered On

Re: Invoke ForAll at OnSuccess

Thanks @v-xida-msft , I'm not using Choice-type columns in SharePoint, just single line text.

 

I actually solved it (I think). What I think was the issue is that referencing the SelectedItems property of ComboBoxes that sit within datacards in the form wasn't possible. While I made sure that I hadn't called ResetForm/NewForm until after the ForAll code, I think the ComboBoxes weren't accessible at the moment that the code ran.

 

I got around this by adding the selected items to collections when the submit button is pressed, then iterating these using ForAll.

View solution in original post

Community Support Team
Community Support Team

Re: Invoke ForAll at OnSuccess

Hi @Cripp88 ,

Have you solved your problem?

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,990)