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

Update a value in one SharePoint list when a record is created in another Sharepoint list using PowerApps

I have two data sources:

 

AccidentReport = this is a new form and is completed whenever someone has an accident at work. One of the columns in this data source is called “BeenInvestigated”, which is set to false by default.

InvestigateReport = This is a new form and is completed whenever an Investigator decides to looks into the submitted accidents from the AccidentReport list.

 

When an accident has been reported, it appears in this dropdown to be investigated:

 

capture-1.png

This is the dropdown’s items property:

 

capture-2.png

I would like to know how to remove the AccidentID from this dropdown, as soon as the InvestigateReport form has been submitted. For example, if AccidentID 38 has been investigated and sent to InvestigateReport as a new entry, I would like 38 to disappear from this dropdown.

 

It would be great if I could update BeenInvestigated in the AccidentReport to true for that record when the corresponding InvestigateReport form has been submitted, but if there is a better way to do this, I’d be happy to hear about it.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @VINdicated09 :

I suggest you add a formula after SubmitForm().

 

Patch(AccidentReport,
      LookUp((AccidentReport,AddidentID=dropdown.Selected.AccidentID),/*Find the corresponding record in AccidentReport*/
      {BeenSubmitted:true})/*Update the value of BeenSubmitted to true*/

 

Because the value of BeenSubmitted for the specified record is no longer false, this option will no longer appear according to the filter conditions in dropdown.

Best Regards,

Bof

View solution in original post

6 REPLIES 6
cds
Impactful Individual
Impactful Individual

You will want to use Patch function. I recommend Shane Young 

I have already used Patch and have followed along with his video. Though I was able to get it to work, my solution isn't great. Below, you can see that my submit button, is actually within a gallery, with all the other elements in that gallery set to visible=false! 

 

capture-3.png

Is there a better way to do this or a way where I can have this button outside of the gallery?

VINdicated09
Helper I
Helper I

 Can someone please help rather than just telling me to search for a video

Hi @VINdicated09 :

I suggest you add a formula after SubmitForm().

 

Patch(AccidentReport,
      LookUp((AccidentReport,AddidentID=dropdown.Selected.AccidentID),/*Find the corresponding record in AccidentReport*/
      {BeenSubmitted:true})/*Update the value of BeenSubmitted to true*/

 

Because the value of BeenSubmitted for the specified record is no longer false, this option will no longer appear according to the filter conditions in dropdown.

Best Regards,

Bof

View solution in original post

cds
Impactful Individual
Impactful Individual

Move your patch and navigate to onsuccess of the form. 

I would set(JustSubmitted, ThisItem) so you can call it easily. 

After rereading this: __I would like to know how to remove the AccidentID from this dropdown, as soon as the InvestigateReport form has been submitted. For example, if AccidentID 38 has been investigated and sent to InvestigateReport as a new entry, I would like 38 to disappear from this dropdown.

 

If patch is working properly, you just need to refresh the dropdown datasource.

Thank you so much. This has worked for me.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,204)