cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

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

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
Resolver II
Resolver II

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.

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

Community Support
Community Support

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.

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

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (3,729)