Skip to main content
List<sobject> tmpOutput = (list<sobject>)JSON.deserialize(str,list<sobject>.class);

[temOutput-->contains one secnario account object and another scenario contains custom objects ]

how to insert sobject list values 

in my secnario i need to insert all custom and standard

objects records   at time in dynamically
1 件の回答
  1. 2020年1月3日 18:44
    Hi Mahmed

    List<Sobject> records will do dml operations as useuall.

    Like : 

    List<Sobject>listobj = new List<Sobject>();

    Account a=new Account(Name='Test Account');

    Contact c = new Contact(LastName='Test Contact');

    listobj.add(a);

    listobj.add(c);

    insert listobj;

    So you should take care of while (list<sobject>)JSON.deserialize(str,list<sobject>.class). Check the output.

    Other than this nothing to add here.

    Are you facing any issues while doing DML Operations? If yes please share the errors here will figure out the solution.

    Useful link: https://salesforce.stackexchange.com/questions/147234/dml-operation-on-listsobjects-where-i-got-the-record-id-of-various-objects

    Regards

    Vijay
0/9000