1
If you already have the name, Type.forName can do this. Also, you can use the new(ish) switch statement for better legibility:
String jSONSObject = '{}';
String sObjectApiName = 'Account';
Map<String, Object> fieldMap = (Map<String, Object>)JSON.deserializeUntyped(jSONSObject);
SObject newSobject = (sObject)Type.forName('Schema',sObjectApiName)....
1
Custom Metadata Types support various relationships. They can have multiple records created against them which would allow you to manage individual mappings. They even allow you to have effectively parent/child relationships. Combining this with Entity Definition and Field Definition type fields would allow you to create the sort of configuration you've ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
sobject × 506apex × 232
soql × 49
visualforce × 31
rest-api × 28
describesobject × 28
trigger × 27
list × 25
map × 25
custom-object × 21
json × 20
sobjecttype × 19
fields × 18
soap-api × 17
sobjectfield × 17
unit-test × 15
query × 15
lightning-aura-components × 14
custom-field × 13
standard-objects × 13
dynamic-apex × 13
schema × 12
relationships × 11
salesforce-id × 11
dynamic-soql × 10