I have one excel with SFDC label Name, as a header and their corresponding records, and using lightning component I need to Create record from that.
My Approach :
I am taking the input in apex from js controller in json form [{"Supplier Invoice Number":"14489","Amount(Gross)":"999.99","Description":"App","Status":"Downloaded"}, ...]
and deserialized using untyped after which i used Schema.SObjectField to get the field API, label and datatype and then using further to iterate over excel header and adding the values in a map to insert.
My Blocker : In future there could be a possibility that label could be duplicate or any extra fields get added on, then in apex code we need to update a logic, so i want to reduce the effort at code level as much as possible after any change in field datatype or add on field in excel.
My Query : So shall i go with custom metadata by creating the two fields as Field API and Field Label and user will manually map the excel field with Metadata and i will be using from here or shall i go with my previous approach.
Thanks Pranav