How to switch from New Form to Edit Form after record creation in Power Apps Canvas Apps?

This is my another blog on Power Apps and quite an interesting one. The requirement is to show the newly created record in an edit form immediately after creating the record.

After reading this blog you should be able to handle the following requirements.

  • Switch the form mode of Power Apps Canvas apps from new mode to edit mode.
  • Open the record in Edit Mode immediately after creating the record.

Let’s see how can we accomplish the requirement. I have created a simple demo. Data source shall be my favorite one – DataVerse.

On click of the new button, I launch the form to create an account. Once the account is saved, the form mode shall change and the newly created record shall open in edit mode.

Switch from New form to edit from in PowerApps canvas apps

In the OnSelect event of the Save button, I put the below formula.

SubmitForm(Form1);
If(
    Not(
        IsBlank(Form1.LastSubmit)
        ), 
    Set(EditItem, Form1.LastSubmit);
    EditForm(Form1)
);

Let’s analyze the formula here.

  • Submit the form
  • If the submit is successful, then Set a variable “EditItem” to Form1.LastSubmit. This is probably the most important step. Form1.LastSubmit contain the last submitted record through the form.
  • Finally open the form in edit mode.

In the above formula, EditItem variable is a global variable that I use to store the value of Form1.LastSubmit. You can use a local variable too and set it using UpdateContext function.

The final step is set EditItem to the Item property of the form.

All set. Below is whole functionality in action.

Hope this helped!

You might also like the below posts

Debajit Dutta
Business Solutions MVP