form data load issue when saving as duplicate record is made
Hello.
I have a form with a lookup when a value is selected the data from the corresponding record is filled into all of the fields in the form. But the form is loaded in such a state that if any value is changed it will take all of the values pre loaded into the form and make a duplicated record. The fomr is loaded only with the "Submit" and "Reset" buttons.
I want the form to behave like in edit mode as if accessed via a report.
But they want to be able to open the form and select a customer and make the edits within the form. so is there a way to make this work as if it was opend from a report?
the code i'm using to populate the form is attached below for example.
- if(input.Customer_Key != null)
{
SelectedRecords = customers[ID == input.Customer_Key];
if(SelectedRecords.count() > 0)
{
input.Contact = SelectedRecords.Contact_One;
input.Address_Line_1 = SelectedRecords.Address_Line_11;
input.Address_Line_2 = SelectedRecords.Address_Line_21;
input.Town = SelectedRecords.Town;
input.County = SelectedRecords.County;
input.Company_Name = SelectedRecords.Company_Name;
input.Currency = SelectedRecords.Currency.Customer_Currency;
input.VAT_Code = SelectedRecords.VAT_Code;
input.Company2 = SelectedRecords.Company_Name;
input.Address_Line_11 = SelectedRecords.Address_Line_11;
input.Address_Line_12 = SelectedRecords.Address_Line_21;
input.Town1 = SelectedRecords.Town;
input.County1 = SelectedRecords.County;
input.Postcode1 = SelectedRecords.Postcode;
input.County1 = SelectedRecords.County;
input.Warning_Credit_Stopped = SelectedRecords.Credit_Stopped;
input.Type_field = SelectedRecords.Customer_Type.Customer_Type;
input.Company_Name1 = SelectedRecords.Delivery_Address.Delivery_Address_Name;
}
}