You need to sign in to do that
Don't have an account?

how to insert new records using SOQL
Hi All,
this is my query: its working well.
Thank you.
this is my query: its working well.
Merchandise__c mer = new Merchandise__c(Name='Book1',Description__c='New Book1', Price__c=400, Total_Inventory__c=50000); // insert merchandise using DML insert mer;but i want to insert in another way for that one code here: its getting error like variable doent exit: Name.
List<Merchandise__c> mer = new List<Merchandise__c>{Name='Book1',Description__c='New Book1',Price__c=500, Total_Inventory__c=10000}; upsert mer;Could you pls tell me anyone, what is the different b/w them. And when i should use collection.
Thank you.
list is used to Optimize your code.
Refert Best Practice #4: Using Collections in the link below
https://developer.salesforce.com/page/Apex_Code_Best_Practices
another example
List<String> myStrings = new List<String> { 'one', 'two' };