I have an object instance of a sObject, for example Product.
Product2 x = new Product2();
Now I can access the field of object like that
x.Name = 'Bruce Wayne';
My questions is about this
.Name
part.
Is there any workaround to access field of our sObject with a String? What I mean
String s ='Name';
x.s = 'Bruce Wayne';
I have a certain Field API's in Custom Metadata and I need access only fields from this Metadata. I can retrieve them via SOQL, but what then? I have strings and can't do anything more. I have already tried converting String to schemaField sObject, but it does not work since after a dot operator (x.) the Apex automatically treat everything as a hardcoded field API value.
Thanks:)