web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Edit form to Submit as...
Power Apps
Unanswered

Edit form to Submit as New Form

(0) ShareShare
ReportReport
Posted on by 117

Good day,

 

@RezaDorrani So this is the one I was asking in the youtube previously. Sorry still new in powerapps. Advance Thanks

 

I have a Code for "SAVE AS NEW" function using "Patch" instead of "SubmitForm" During EditForm Mode. However, the code is too long due to length of form.

 

Is there anyway to simplify this? (Because this is just too long i think to simply do "SAVE AS NEW"?)

Furthermore, how can patch work to require all those with Required = True to check it as well before submitting?

 

Set(varRecord,Patch('PADMOUNTED TRANSFORMER',{'Test ID':Text(DataCardValue2.SelectedDate,"yyyy-mm-dd-PDMT-")& Last('PADMOUNTED TRANSFORMER').ID+1,
Client:Client_DataCard1.Update,
Address:Address_DataCard1.Update,
'Project Code':'Project Code_DataCard1'.Update,
'Date of Test':'Date of Test_DataCard1'.Update,
Equipment:Equipment_DataCard1.Update,
'Capacity (kVA)':Capacity_DataCard1.Update,
'Primary Voltage':'Primary Voltage_DataCard1'.Update,
'Secondary Voltage':'Secondary Voltage_DataCard1'.Update,
Frequency:Frequency_DataCard1.Update,
'Total Weight':'Total Weight_DataCard1'.Update,
Make:Make_DataCard1.Update,
'Serial Number':'Serial Number_DataCard1'.Update,
'Manufacturing Date':'Manufacturing Date_DataCard1'.Update,
'Insulating Fluid':'Insulating Fluid_DataCard1'.Update,
'Insulating Fluid Volume':'Insulating Fluid Volume_DataCard1'.Update,
'Transformer Type':'Transformer Type_DataCard1'.Update,
'% Impedance':'% Impedance_DataCard1'.Update,
'Insulation Class':'Insulation Class_DataCard1'.Update,
Connection:Connection_DataCard1.Update,
'Temperature (°C)':'Temperature (°C)_DataCard1'.Update,
'Relative Humidity (%)':'Relative Humidity_DataCard1'.Update,
'TTR Primary Voltage':'TTR Primary Voltage_DataCard1'.Update,
'TTR Secondary Voltage':'TTR Secondary Voltage_DataCard1'.Update,
'TTR Computed Value':'TTR Computed Value_DataCard1'.Update,
'TTR Phase A':'TTR Phase A_DataCard1'.Update,
'TTR Phase B':'TTR Phase B_DataCard1'.Update,
'TTR Phase C':'TTR Phase C_DataCard1'.Update,
'TTR Phase A % Deviation':'TTR Phase A % Deviation_DataCard1'.Update,
'TTR Phase B % Deviation':'TTR Phase B % Deviation_DataCard1'.Update,
'TTR Phase C % Deviation':'TTR Phase C % Deviation_DataCard1'.Update,
'TTR Remarks':'TTR Remarks_DataCard1'.Update,
'IR PS 1 Minute (MΩ)':'IR PS 1 Minute (MΩ)_DataCard1'.Update,
'IR PG 1 Minute (MΩ)':'IR PG 1 Minute (MΩ)_DataCard1'.Update,
'IR SG 1 Minute (MΩ)':'IR SG 1 Minute (MΩ)_DataCard1'.Update,
'IR PS 10 Minute (MΩ)':'IR PS 10 Minute (MΩ)_DataCard1'.Update,
'IR PG 10 Minute (MΩ)':'IR PG 10 Minute (MΩ)_DataCard1'.Update,
'IR SG 10 Minute (MΩ)':'IR SG 10 Minute (MΩ)_DataCard1'.Update,
'IR PS Corrected at 20°C':'IR PS Corrected at 20°C_DataCard1'.Update,
'IR PG Corrected at 20°C':'IR PG Corrected at 20°C_DataCard1'.Update,
'IR SG Corrected at 20°C':'IR SG Corrected at 20°C_DataCard1'.Update,
'PS Polarization Index':'PS Polarization Index_DataCard1'.Update,
'PG Polarization Index':'PG Polarization Index_DataCard1'.Update,
'SG Polarization Index':'SG Polarization Index_DataCard1'.Update,
'IR Remarks':'IR Remarks_DataCard1'.Update,
'IODBV Test 1 (kV)':'IODBV Test 1 (kV)_DataCard1'.Update,
'IODBV Test 2 (kV)':'IODBV Test 2 (kV)_DataCard1'.Update,
'IODBV Test 3 (kV)':'IODBV Test 3 (kV)_DataCard1'.Update,
'IODBV Test 4 (kV)':'IODBV Test 4 (kV)_DataCard1'.Update,
'IODBV Test 5 (kV)':'IODBV Test 5 (kV)_DataCard1'.Update,
'IODBV Test 6 (kV)':'IODBV Test 6 (kV)_DataCard1'.Update,
'IODBV Test Average (kV)':'IODBV Test Average_DataCard1'.Update,
'IODBV Remarks':'IODBV Remarks_DataCard1'.Update,
'WR Primary Phase A (Ω)':'WR Primary Phase A (Ω)_DataCard1'.Update,
'WR Primary Phase B (Ω)':'WR Primary Phase B (Ω)_DataCard1'.Update,
'WR Primary Phase C (Ω)':'WR Primary Phase C (Ω)_DataCard1'.Update,
'WR Secondary Phase A (mΩ)':'WR Secondary Phase A (mΩ)_DataCard1'.Update,
'WR Secondary Phase B (mΩ)':'WR Secondary Phase B (mΩ)_DataCard1'.Update,
'WR Secondary Phase C (mΩ)':'WR Secondary Phase C (mΩ)_DataCard1'.Update,
'WR Remarks':'WR Remarks_DataCard1'.Update,
'EC Test Voltage 1':'EC Test Voltage 1_DataCard1'.Update,
'EC Test Voltage 2':'EC Test Voltage 2_DataCard1'.Update,
'EC Test Voltage 3':'EC Test Voltage 3_DataCard1'.Update,
'Excitation Current 1':'Excitation Current 1_DataCard1'.Update,
'Excitation Current 2':'Excitation Current 2_DataCard1'.Update,
'Excitation Current 3':'Excitation Current 3_DataCard1'.Update,
'Excitation Current Remarks':'Excitation Current Remarks_DataCard1'.Update,
'Temperature (°C) during IPF':'Temperature (°C) during IPF_DataCard1'.Update,
'IPF PS Current (mA)':'IPF PS Current (mA)_DataCard1'.Update,
'IPF PS Power (W)':'IPF PS Power (W)_DataCard1'.Update,
'IPF PG Current (mA)':'IPF PG Current (mA)_DataCard1'.Update,
'IPF PG Power (W)':'IPF PG Power (W)_DataCard1'.Update,
'IPF SG Current (mA)':'IPF SG Current (mA)_DataCard1'.Update,
'IPF SG Power (W)':'IPF SG Power (W)_DataCard1'.Update,
'IPF PS %':'IPF PS %_DataCard1'.Update,
'IPF PS % Corrected at 20°C':'IPF PS % Corrected at 20°C_DataCard1'.Update,
'IPF PG %':'IPF PG %_DataCard1'.Update,
'IPF PG % Corrected at 20°C':'IPF PG % Corrected at 20°C_DataCard1'.Update,
'IPF SG %':'IPF SG %_DataCard1'.Update,
'IPF SG % Corrected at 20°C':'IPF SG % Corrected at 20°C_DataCard1'.Update,
'IPF PG (μF)':'IPF PG (μF)_DataCard1'.Update,
'IPF PS (μF)':'IPF PS (μF)_DataCard1'.Update,
'IPF SG (μF)':'IPF SG (μF)_DataCard1'.Update,
'IPF Remarks':'IPF Remarks_DataCard1'.Update,
H0:H0_DataCard1.Update,
H1:H1_DataCard1.Update,
H2:H2_DataCard1.Update,
H3:H3_DataCard1.Update,
X0:X0_DataCard1.Update,
X1:X1_DataCard1.Update,
X2:X2_DataCard1.Update,
X3:X3_DataCard1.Update,
Radiator:Radiator_DataCard1.Update,
'Tank, Enclosures & Locks':'Tank, Enclosures & Locks_DataCard1'.Update,
'H-Side Grounding':'H-Side Grounding_DataCard1'.Update,
'X-Side Grounding':'X-Side Grounding_DataCard1'.Update,
'Pressure Indicator':'Pressure Indicator_DataCard1'.Update,
'Level Indicator':'Level Indicator_DataCard1'.Update,
'Temperature Indicator':'Temperature Indicator_DataCard1'.Update,
'Tap Changer':'Tap Changer_DataCard1'.Update,
'T-Blade Switch':'T-Blade Switch_DataCard1'.Update,
'Bay-O-Net Fuse':'Bay-O-Net Fuse_DataCard1'.Update,
'Current Limiting Fuse':'Current Limiting Fuse_DataCard1'.Update,
'Pressure Relief Valve':'Pressure Relief Valve_DataCard1'.Update,
'Overall Remarks':'Overall Remarks_DataCard1'.Update,
Remarks:Remarks_DataCard1.Update,
'Tested by':'Tested by_DataCard1'.Update,
'Prepared by (Name)':'Prepared by (Name)_DataCard1'.Update,
'Prepared by (Signature)':'Prepared by (Signature)_DataCard1'.Update,
'Prepared by (Designation)':'Prepared by (Designation)_DataCard1'.Update,
'Witnessed by (Name)':'Witnessed by (Name)_DataCard1'.Update,
'Witnessed by (Signature)':'Witnessed by (Signature)_DataCard1'.Update,
'Witnessed by (Designation)':'Witnessed by (Designation)_DataCard1'.Update,
'Tap Setting':If(!IsBlank(DataCardValue22.Selected),DataCardValue22.Selected,If(!IsBlank(DataCardValue22.SearchText),{Value: DataCardValue22.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'TTR Test Equipment':If(!IsBlank(DataCardValue23.Selected),DataCardValue23.Selected,If(!IsBlank(DataCardValue23.SearchText),{Value: DataCardValue23.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'IR Test Equipment Used':If(!IsBlank(DataCardValue34.Selected),DataCardValue34.Selected,If(!IsBlank(DataCardValue34.SearchText),{Value: DataCardValue34.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'PS Test Voltage':If(!IsBlank(DataCardValue35.Selected),DataCardValue35.Selected,If(!IsBlank(DataCardValue35.SearchText),{Value: DataCardValue35.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'PG Test Voltage':If(!IsBlank(DataCardValue37.Selected),DataCardValue37.Selected,If(!IsBlank(DataCardValue37.SearchText),{Value: DataCardValue37.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'SG Test Voltage':If(!IsBlank(DataCardValue39.Selected),DataCardValue39.Selected,If(!IsBlank(DataCardValue39.SearchText),{Value: DataCardValue39.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'IODBV Test Equipment':If(!IsBlank(DataCardValue51.Selected),DataCardValue51.Selected,If(!IsBlank(DataCardValue51.SearchText),{Value: DataCardValue51.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'WR Test Equipment':If(!IsBlank(DataCardValue60.Selected),DataCardValue60.Selected,If(!IsBlank(DataCardValue60.SearchText),{Value: DataCardValue60.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'Excitation Current Test Equipment':If(!IsBlank(DataCardValue68.Selected),DataCardValue68.Selected,If(!IsBlank(DataCardValue68.SearchText),{Value: DataCardValue68.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'EC Test Connection 1':If(!IsBlank(DataCardValue69.Selected),DataCardValue69.Selected,If(!IsBlank(DataCardValue69.SearchText),{Value: DataCardValue69.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'EC Test Connection 2':If(!IsBlank(DataCardValue70.Selected),DataCardValue70.Selected,If(!IsBlank(DataCardValue70.SearchText),{Value: DataCardValue70.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'EC Test Connection 3':If(!IsBlank(DataCardValue71.Selected),DataCardValue71.Selected,If(!IsBlank(DataCardValue71.SearchText),{Value: DataCardValue71.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank())),
'IPF Test Equipment':If(!IsBlank(DataCardValue73.Selected),DataCardValue73.Selected,If(!IsBlank(DataCardValue73.SearchText),{Value: DataCardValue73.SearchText,'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"},Blank()))
}));

If(!IsBlank(varRecord),
Notify("Your request has been submitted!",NotificationType.Success),
Notify("Your request was not submitted",NotificationType.Error)
);)

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    152,867 Most Valuable Professional on at

    Hi @grapejuice ,

    You will have to forgive me for not reading through all of that, but why are you simply not using SubmitForm and putting any conditional arguments on the Update of the relevant Data Card - or if you really want to Patch

    Patch(
     'PADMOUNTED TRANSFORMER'
     YourFormName.Updates
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • grapejuice Profile Picture
    117 on at

    Hello @WarrenBelz ,

     

    So I have 3 conditions

    1. SubmitForm - From New Form to Submit as new ID

    2. EditForm - to Save and do not create new ID just replace values from existing ID

    3. "Save As" - To use the previous form from database and just edit values, but submit as new ID.

     

    Sorry I cannot seem to get this to work

     

    Patch(
     'PADMOUNTED TRANSFORMER'
     YourFormName.Updates
    )

     

    the form Name is "PDMT_Form"

     

    I tried 

    Patch(
    'PADMOUNTED TRANSFORMER'
    PDMT_FORM.Updates
    )

     

     

     

    Also, i used a long patch because someone told me it has to be one by one? is this not the case?

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Edit-form-and-Submit-as-New-Form/m-p/1317707

     

    i would really appreciate it if the code you provide or something like that works. to patch entire form with a few coding only. Thank you

  • WarrenBelz Profile Picture
    152,867 Most Valuable Professional on at

    Hi @grapejuice ,

    Firstly your Form Mode - NewForm(YourFormName) or EditForm(YourFormName) should take care of New and Edit - simply submit the form in the appropriate mode. As I mentioned, you can put any conditional elements in the Update of the Data Card.

    The last one however is a bit more complicated (and unusual - I have never seen it asked before) and other than doing what you are doing, I cannot think of another way presently.

     

  • timl Profile Picture
    36,328 Super User 2025 Season 2 on at

    @grapejuice 

    In answer to your third question "Save As - Use the previous form from database and just edit values, but submit as new ID", you can accomplish this by patching a blank ID value for form in edit mode, before calling SubmitForm.

    I have a post here with more details:
    http://powerappsguide.com/blog/post/save-an-existing-record-as-a-new-record

     

  • WarrenBelz Profile Picture
    152,867 Most Valuable Professional on at

    Thanks @timl ,

    I sort of had my mind in that direction, but the key thing here though is that the record may have been edited after it was created on the form and I was thinking you have to submit it as a new first and if you only wanted the Save As, you would then need to then delete the original summitted record - using a blank ID on an edit form is a neat trick.

  • grapejuice Profile Picture
    117 on at

    @timl  and @WarrenBelz 

    thank you for the responses.

     

    The Submit as new form using old data is the struggle i am facing. patching it 1 by 1 is also to tedious that is why i am searching for faster way.

     

    The reason i need the "Save As" is there are too many data and sometimes only a part of the form will replaced, i.e. some values will remain the same (i.e. Client, date of test, address, etc are the same and only some will change) Rather than the user repeating the entire form, at least they can just use an old data.

    I will try to understand the link provided first, hopefully i do get what you mean. still struggling with the coding

  • grapejuice Profile Picture
    117 on at

    Sorry upon reading content of http://powerappsguide.com/blog/post/save-an-existing-record-as-a-new-record  i do not get how to do it sadly

  • grapejuice Profile Picture
    117 on at

    Regarding

    Patch(
     'PADMOUNTED TRANSFORMER'
     YourFormName.Updates
    )

    How to make this work?

    the form Name is "PDMT_Form"

     

    I tried 

    Patch(
    'PADMOUNTED TRANSFORMER'
    PDMT_FORM.Updates
    )

     

    and it shows errors for me

     

    grapejuice_0-1635595036671.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 759 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 310 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 228

Last 30 days Overall leaderboard