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.
Solved! Go to Solution.
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.
Are you usinf SubmitForm() or Patch() to create an Incident Report?
At the moment I'm using SubmitForm
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.
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?
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.
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.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
274 | |
229 | |
79 | |
37 | |
37 |
User | Count |
---|---|
346 | |
229 | |
124 | |
70 | |
55 |