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

Passing value between forms

Hey there, I'm a newbie so sorry in advance.

 

I have created an app from scratch from excel sheet in One Drive. The Excel sheet has two Tables in it. Table1=Incident Report table, and Table2=Witness Statement table.

 

In my app,  I have a "Submit an Incident Report" page where they are able to fill out the fields and it will submit to Table1 in my excel sheet. When they fill out this Incident Report form, all fields are in edit mode, except "Incident ID" which is a field in display mode. It creates an ID for each report. This part works just fine.

 

Here is the complicated part:

I need to be able to add a witness statement (actually multiple witness statements), generated from Table2, to an incident report. So far I have created the witness statment from from Table 2 in the same way as the incident report, I just need help creating a formula that will pull the "Incident ID" from the other form, automatically to the Witness Statement form, but then once submitted, it still needs to submit to the "Incident ID" to the Witness Statement table (table2) in Excel. 

 

I realize this sounds confusing, any suggestions would very much help.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Passing value between forms

In the OnSuccess of the Form you can set a global variable to the Incident ID of record that was just created/updated. Then you can use that variable on the Witness Statement form.

 

Example of the OnSuccess formula:

Set(gvLastSubmittedRecord, 'TheNameOfYourForm'.LastSubmit.ID)

 

*You will need to change the name of the form and ".ID" if that isn't the name of the Incident ID field.

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Passing value between forms

Are you usinf SubmitForm() or Patch() to create an Incident Report?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
TorreyFalconer
Level: Powered On

Re: Passing value between forms

At the moment I'm using SubmitForm

Super User
Super User

Re: Passing value between forms

In the OnSuccess of the Form you can set a global variable to the Incident ID of record that was just created/updated. Then you can use that variable on the Witness Statement form.

 

Example of the OnSuccess formula:

Set(gvLastSubmittedRecord, 'TheNameOfYourForm'.LastSubmit.ID)

 

*You will need to change the name of the form and ".ID" if that isn't the name of the Incident ID field.

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

TorreyFalconer
Level: Powered On

Re: Passing value between forms

@Jeff_Thorpe 

Thanks, this worked for making the same value appear on the second screen, but I still need that same ID to save to the ID section on the witness statement table as well. How do I connect that GV to the Incident ID column in table 2?

TorreyFalconer
Level: Powered On

Re: Passing value between forms

@Jeff_Thorpe Nevermind! Got it! Thanks!

TorreyFalconer
Level: Powered On

Re: Passing value between forms

Hey @Jeff_Thorpe 

 

One more question regarding this- how would I set a global variable from a form that is in view mode? I basically want to do the same thing as above, however I want them to go to their gallery of "Previously Submitted Incident Reports" and be able to add a witness statment. The detail form would be in view mode but they could from there click a button and add a witness statement which would draw the Incident ID from the form in view mode. 

Super User
Super User

Re: Passing value between forms

On the button click to create the Witness Statement from the detailed view form you could set the variable.

 

Button > OnSelect:  Set(gvLastSubmittedRecord, DataCardValue1.text)

 

You can use the same variable or change the name and created a variable just for this situation.

The "DataCardValue1" needs to be changed to the name of the control on the view form that has the ID value.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,223)