Hello @sasishaan
The solution provided by Daniel in the begining won't work for now, perhaps it worked in the past, but now it won't work.
As I mentioned earlier, once the form is created using "NewForm" the FormMode will always remain "New" and the same applies to EditForm.
So the suggested workaround, which worked for me, is to create a new form using "NewForm" and pass all the values you want to copy to the new form using the context. then assign those values if it's a copied item. check the following example:
Let's say I have a form with three fields: Name, Age and Gender. I want to be able to create a new item or to copy the information of an existing item, edit them, then submit them to create a new item.
1- as you said, you will need two buttons, let's call them "Add new" and "Copy"
2- change OnSelect for "Copy" button to:
NewForm(EditForm1);Navigate(EditScreen1,ScreenTransition.None,{IsCopiedItem:true, CopiedName:BrowseGallery1.Selected.Name, CopiedAge:BrowseGallery1.Selected.Age, CopiedGender:BrowseGallery1.Selected.Gender})you could also pass the values of the datacards on your form, if you were on DetailScreen like this:
NewForm(EditForm1);Navigate(EditScreen1,ScreenTransition.None,{IsCopiedItem:true, CopiedName:DataCardValue1.text, CopiedAge:DataCardValue2.text, CopiedGender:DataCardValue3.text})DataCardValue is the name of the textbox that holds the value you want to copy
you can add as many fields as you want between the parentheses seperated by ","
3- on the EditScreen you click on the textbox of the card holding the Name value and change the Defualt value to:
If(IsCopiedItem,CopiedName,Parent.Default)
repeat for each value you passed, Age and Gender in my example.
4- you are almost done here, the only thing you need to do is to set the value of IsCopiedItem to false. This step might not be needed, I only did it to be 100% sure things are under control.
click on the EditForm1 and change OnSuccess to:
UpdateContext({IsCopiedItem:false,}); Back()I hope this helps you
Best,
Alaa