cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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?

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

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (49,465)