Skip to content

Instantly share code, notes, and snippets.

@mtetlow
Created July 2, 2015 14:04
Show Gist options
  • Save mtetlow/45154749816bdf83bce6 to your computer and use it in GitHub Desktop.
Save mtetlow/45154749816bdf83bce6 to your computer and use it in GitHub Desktop.
sObject sObj = Schema.getGlobalDescribe().get('Account').newSObject();
sObject sObj2 = Schema.getGlobalDescribe().get('Account').newSObject();
List<sObject> sObjList = new List<sObject>();
sObjList.add(sObj);
sObjList.add(sObj2);
List<Account> accountList = (List<Account>)sObjList;
upsert accountList;
//Results in
System.TypeException: DML on generic List only allowed for insert, update or delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment