@futr_vision - in summary, you will need to follow the instructions provided rather than taking the parts you think you need. Some comments in blue below:
-----------------------------------------------------------------------------------------------------------------------------
For my gallery item I don't have a button per se but clicking on the item writes the record to the global variable like this:
Set(
glbFormData,
GAL_Campaigns.Selected
);
That's fine, you would just use the OnSelect property of the Gallery control. I note however you are not setting the "gbl_copy" variable to false, which ideally, you should do.
I did this because I have a form on the page, used for viewing and editing the record, that uses the global variable for the Item.
Then I have a separate button for the copy function. That button uses this code when selected
Set(
glbFormData,
GAL_Campaigns.Selected
);
Set(
varCopy,
true
);
EditForm(FRM_CampaignForm);
Navigate('Create Campaign');
You need to follow the instructions provided. We do not want to set the Form Mode to Edit on the Copy button, but to New.
Now, for the form being copied too my datacards are just using
This.'The field for this DataCard'
I didn't add in a check for the varCopy since I set the Item for this form also to the global variable (varGlobalForm)
You must use the formula provided for the Default property of the DataCard. Without this formula, the DataCard will simply return blank because we have set the EditForm mode to New Mode.
This all works great except when I submit the form it overwrites.
After reviewing your code, it looks like I need to set the form to New First and then switch it to Edit. Is that the piece I am missing?