Skip to content

Instantly share code, notes, and snippets.

@mhamzas
Created April 26, 2021 10:32
Show Gist options
  • Select an option

  • Save mhamzas/b0fa92c15598470f613351ec47a49a3a to your computer and use it in GitHub Desktop.

Select an option

Save mhamzas/b0fa92c15598470f613351ec47a49a3a to your computer and use it in GitHub Desktop.
Inserting sObject Record Dynamically in Salesforce
String objName = 'Account';
String recordName = 'Salesforce';
sObject sObj = Schema.getGlobalDescribe().get(objName).newSObject();
sObj.put('Name', recordName) ;
Insert sObj ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment