I tried creating a new entity reference, but it is always blank. I also tried the following code, but I get an object error now.
if (localContext.PreImage.GetAttributeValue<EntityReference>("customerid").LogicalName != null)
{
Guid tmpCustomerGuid= localContext.PreImage.GetAttributeValue<EntityReference>("customerid").Id;
tmpCustomerObject = new EntityReference("Account",tmpCustomerGuid);
}
The fields are populated as I made the mandatory on the form.
Any help would be appreciated.