1. Create 20 new Accounts Records in salesforce with at least 5 fields filled.
Click here to learn more
{ Account a=new Account();
a.Name=’Name’ + i;
a.AccountNumber=’123′;
a.Rating=’Hot’; a.Fax=’23456′;
a.Description=’xyz’;
insert a; }
Click here to learn more
2. Create 10 Contacts with diferent Account(LookUp) values(Relationship with no same 2 accounts) in them.
Click here to learn more
accList = [SELECT Id,Name FROM Account LIMIT 20];
List<Contact> conList=new List<Contact>();
integer j =0;
for(integer i=1;i<10;i++){
j=j+1;
Contact con=new Contact();
con.LastName= accList.get(j).Name;
con.AccountId=accList.get(j).Id;
conList.add(con);
} Insert conList;
Click here to learn more
07:58:12.905|CUMULATIVE_LIMIT_USAGE_END
07:58:12.153 (153597808)|CODE_UNIT_FINISHED|execute_anonymous_apex 07:58:12.154 (154969266)|EXECUTION_FINISHED
3. Create 20 Opportunity with Closed Date, Status and Opportunity Name
Click here to learn more
for(integer i=21;i<41;i++){
Opportunity opp = new Opportunity();
opp.Name=’Name’+i;
opp.closeDate=system.today();
opp.DeliveryInstallationStatus__c= ‘yet to begin’;
opp.StageName=’Qualification’+i;
opp1.add(opp);
} insert opp1;
Click here to learn more
Execute Anonymous: list<opportunity> opp1=new list<opportunity>(); Execute Anonymous: for(integer i=21;i<41;i++){ Execute Anonymous: Opportunity opp = new Opportunity(); Execute Anonymous: opp.Name=’Name’+i; Execute Anonymous: opp.closeDate=system.today(); Execute Anonymous: opp.DeliveryInstallationStatus__c= ‘yet to begin’; Execute Anonymous: opp.StageName=’Qualification’+i; Execute Anonymous: opp1.add(opp); Execute Anonymous: Execute Anonymous: } Execute Anonymous: insert opp1; 06:06:15.040 (40850684)|EXECUTION_STARTED 06:06:15.040 (40859609)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 06:06:15.041 (41538462)|SYSTEM_CONSTRUCTOR_ENTRY|[1]|<init>() 06:06:15.041 (41585472)|SYSTEM_CONSTRUCTOR_EXIT|[1]|<init>() 06:06:15.041 (41804427)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.041 (41847958)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.042 (42028072)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.042 (42066769)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.042 (42218606)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.042 (42250832)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.042 (42323121)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.042 (42350788)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.042 (42392417)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.042 (42410452)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.042 (42455831)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.042 (42472197)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.042 (42543756)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.042 (42562420)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.042 (42614538)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.042 (42629375)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.042 (42667062)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.042 (42684654)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.042 (42727545)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.042 (42743394)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.042 (42822820)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.042 (42841662)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.042 (42893151)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.042 (42908018)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.042 (42945661)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.042 (42962946)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.043 (43006108)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.043 (43022275)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.043 (43091739)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.043 (43110466)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.043 (43161827)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.043 (43176616)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.043 (43233480)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.043 (43255777)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.043 (43305226)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.043 (43321713)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.043 (43392289)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.043 (43410823)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.043 (43462784)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.043 (43509581)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.043 (43558937)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.043 (43577487)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.043 (43624356)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.043 (43640682)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.043 (43711446)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.043 (43730191)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.043 (43790011)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.043 (43805465)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.043 (43843521)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.043 (43860917)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.043 (43904484)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.043 (43920307)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.043 (43990670)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.044 (44009029)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.044 (44061601)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44076241)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44113281)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.044 (44133921)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.044 (44198967)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.044 (44216323)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.044 (44290857)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.044 (44310299)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.044 (44362698)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44406673)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44457866)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.044 (44476670)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.044 (44523603)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.044 (44539639)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.044 (44610345)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.044 (44629325)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.044 (44681636)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44696603)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44734648)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.044 (44759167)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.044 (44804990)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.044 (44820842)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.044 (44897183)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.044 (44915830)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.044 (44967677)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.044 (44982869)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45020346)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.045 (45038717)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.045 (45081985)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.045 (45097851)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.045 (45167439)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.045 (45185799)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.045 (45237005)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45252428)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45289712)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.045 (45314353)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.045 (45359022)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.045 (45397833)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.045 (45493635)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.045 (45513721)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.045 (45566902)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45582123)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45619971)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.045 (45636991)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.045 (45679888)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.045 (45696017)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.045 (45772736)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.045 (45791835)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.045 (45844778)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45859641)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.045 (45897350)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.045 (45915033)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.045 (45958154)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.045 (45973866)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.046 (46043571)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.046 (46062694)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.046 (46114140)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.046 (46129034)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.046 (46166454)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.046 (46183581)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.046 (46226548)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.046 (46242199)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.046 (46311385)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.046 (46330057)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.046 (46380768)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.046 (46395632)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.046 (46433124)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.046 (46450421)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.046 (46495937)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.046 (46519434)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.046 (46607813)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.046 (46627601)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.046 (46680302)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.046 (46695751)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.046 (46772205)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.046 (46793437)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.046 (46842713)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.046 (46859144)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.046 (46929876)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.046 (46948566)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.047 (47000883)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47016816)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47054808)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.047 (47072035)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.047 (47115380)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.047 (47130970)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.047 (47200289)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.047 (47218684)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.047 (47270132)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47284928)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47322203)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.047 (47339363)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.047 (47382204)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.047 (47397914)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.047 (47467332)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.047 (47486095)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.047 (47537409)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47552045)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47589292)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:06:15.047 (47606392)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:06:15.047 (47649131)|SYSTEM_METHOD_ENTRY|[5]|System.today() 06:06:15.047 (47665027)|SYSTEM_METHOD_EXIT|[5]|System.today() 06:06:15.047 (47734376)|SYSTEM_METHOD_ENTRY|[7]|String.valueOf(Object) 06:06:15.047 (47759343)|SYSTEM_METHOD_EXIT|[7]|String.valueOf(Object) 06:06:15.047 (47812573)|SYSTEM_METHOD_ENTRY|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47827429)|SYSTEM_METHOD_EXIT|[8]|LIST<Opportunity>.add(Object) 06:06:15.047 (47894367)|DML_BEGIN|[11]|Op:Insert|Type:Opportunity|Rows:20 06:06:15.569 (569157706)|DML_END|[11] 06:06:16.065 (635851150)|CUMULATIVE_LIMIT_USAGE 06:06:16.065|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 1 out of 150 Number of DML rows: 20 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 10 Number of Mobile Apex push calls: 0 out of 10
06:06:16.065|CUMULATIVE_LIMIT_USAGE_END
06:06:15.635 (635912346)|CODE_UNIT_FINISHED|execute_anonymous_apex 06:06:15.637 (637352080)|EXECUTION_FINISHED
4. Create 10 Products with different Product Names, Description & Family
Click here to learn more
for(integer i=0;i<10;i++){
Product2 pro = new Product2();
pro.Name=’Name’+i;
pro.Description=’Description’;
pro.Family= ‘None’;
pro1.add(pro);
} insert pro1;
Click here to learn more
Execute Anonymous: list<Product2> pro1=new list<Product2>(); Execute Anonymous: for(integer i=0;i<10;i++){ Execute Anonymous: Product2 pro = new Product2(); Execute Anonymous: pro.Name=’Name’+i; Execute Anonymous: pro.Description=’Description’; Execute Anonymous: pro.Family= ‘None’; Execute Anonymous: pro1.add(pro); Execute Anonymous: } Execute Anonymous: insert pro1; 06:37:48.040 (40356512)|EXECUTION_STARTED 06:37:48.040 (40367458)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 06:37:48.040 (40950998)|SYSTEM_CONSTRUCTOR_ENTRY|[1]|<init>() 06:37:48.040 (40982292)|SYSTEM_CONSTRUCTOR_EXIT|[1]|<init>() 06:37:48.041 (41160135)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.041 (41201880)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.041 (41352413)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41381201)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41422764)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.041 (41440386)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.041 (41537352)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41552486)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41589383)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.041 (41606597)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.041 (41700739)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41715637)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41759169)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.041 (41776670)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.041 (41871694)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41886854)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.041 (41922690)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.041 (41939823)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.042 (42033488)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42050471)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42086646)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.042 (42103721)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.042 (42196605)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42211460)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42247255)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.042 (42264347)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.042 (42357060)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42371882)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42407410)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.042 (42424706)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.042 (42517490)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42532424)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42567904)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.042 (42585256)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.042 (42677953)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42692956)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42736296)|SYSTEM_METHOD_ENTRY|[4]|String.valueOf(Object) 06:37:48.042 (42754443)|SYSTEM_METHOD_EXIT|[4]|String.valueOf(Object) 06:37:48.042 (42849537)|SYSTEM_METHOD_ENTRY|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42864703)|SYSTEM_METHOD_EXIT|[7]|LIST<Product2>.add(Object) 06:37:48.042 (42989313)|DML_BEGIN|[9]|Op:Insert|Type:Product2|Rows:10 06:37:48.108 (108272078)|DML_END|[9] 06:37:48.518 (113336957)|CUMULATIVE_LIMIT_USAGE 06:37:48.518|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 1 out of 150 Number of DML rows: 10 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 10 Number of Mobile Apex push calls: 0 out of 10
06:37:48.518|CUMULATIVE_LIMIT_USAGE_END
06:37:48.113 (113370351)|CODE_UNIT_FINISHED|execute_anonymous_apex 06:37:48.114 (114487432)|EXECUTION_FINISHED
5. Delete all contacts belonging to Accounts Name FIELD having ‘A’ in them
Click here to learn more
delete Contactlist;
Click here to learn more
Execute Anonymous: Execute Anonymous: list<Contact>ContactList = [SELECT Id FROM Contact WHERE Account.Name like ‘%a%’]; Execute Anonymous: delete Contactlist; 07:43:40.035 (35329626)|EXECUTION_STARTED 07:43:40.035 (35347468)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 07:43:40.036 (36578255)|SOQL_EXECUTE_BEGIN|[2]|Aggregations:0|select Id from Contact where Account.Name like ‘%a%’ 07:43:40.044 (44470886)|SOQL_EXECUTE_END|[2]|Rows:0 07:43:40.147 (44874432)|CUMULATIVE_LIMIT_USAGE 07:43:40.147|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 10 Number of Mobile Apex push calls: 0 out of 10
07:43:40.147|CUMULATIVE_LIMIT_USAGE_END
07:43:40.044 (44933251)|CODE_UNIT_FINISHED|execute_anonymous_apex 07:43:40.046 (46125138)|EXECUTION_FINISHED
6. Delete all the Opportunities with Closed Date in past(<Today)
Click here to learn more
delete opplist;
Click here to learn more
Execute Anonymous: list<opportunity>oppList = [SELECT Id FROM opportunity WHERE CloseDate<Today]; Execute Anonymous: delete opplist; 08:35:39.045 (45399860)|EXECUTION_STARTED 08:35:39.045 (45421559)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 08:35:39.046 (46648477)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select Id from opportunity where CloseDate < Today 08:35:39.061 (61133610)|SOQL_EXECUTE_END|[1]|Rows:32 08:35:39.061 (61294147)|DML_BEGIN|[2]|Op:Delete|Type:Opportunity|Rows:32 08:35:39.694 (694651650)|DML_END|[2] 08:35:40.506 (715393650)|CUMULATIVE_LIMIT_USAGE 08:35:40.506|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 32 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 1 out of 150 Number of DML rows: 32 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 10 Number of Mobile Apex push calls: 0 out of 10
08:35:40.506|CUMULATIVE_LIMIT_USAGE_END
08:35:39.715 (715442231)|CODE_UNIT_FINISHED|execute_anonymous_apex 08:35:39.716 (716671116)|EXECUTION_FINISHED
7. Update all Opportunity with future Closed Date by Opportunity Name=Opportunity Name + ‘F’
Click here to learn more
LIST<opportunity> oppList1=new LIST<opportunity>();
for(Opportunity opp:oppList){
opp.Name=opp.Name+’F’;
oppList1.add(opp);
system.debug(‘++++++++++++++’+opp);
}
update oppList;
Click here to learn more
07:57:12.715|CUMULATIVE_LIMIT_USAGE_END
07:57:12.336 (336383634)|CODE_UNIT_FINISHED|execute_anonymous_apex 07:57:12.337 (337854312)|EXECUTION_FINISHED
8. Create Apex class with a function to print ‘Welcome to Salesforce’
Click here to learn more
public void test(){
system.debug(‘Welcome to sales force’); } }
Click here to learn more
06:36:09.283|CUMULATIVE_LIMIT_USAGE_END
06:36:09.073 (73116768)|CODE_UNIT_FINISHED|execute_anonymous_apex 06:36:09.075 (75096979)|EXECUTION_FINISHED
9. Execute the above function from Script
system.debug(‘Welcome to sales force’);
Click here to learn more
04:36:43.181|CUMULATIVE_LIMIT_USAGE_END
04:36:43.041 (41456319)|CODE_UNIT_FINISHED|execute_anonymous_apex 04:36:43.042 (42778992)|EXECUTION_FINISHED
10. Display the current salesforce user details ‘Name’, ‘Number’ & ‘EmailId’
Click here to learn more
system.debug(‘>>>>>>>>>>>>’+u.MobilePhone+’>>>>>>>’+u.Name+’>>>’+u.Email);
Click here to learn more
04:39:09.131|CUMULATIVE_LIMIT_USAGE_END
04:39:09.043 (43132692)|CODE_UNIT_FINISHED|execute_anonymous_apex 04:39:09.044 (44883532)|EXECUTION_FINISHED
11. Print the Account Names in Alphabetical ascending order.
Click here to learn more
for(integer i=0;i<acc.size();i++){
Account a=acc[i];
system.debug(‘+++++++++++++’+a.Name);
}
Click here to learn more
08:02:32.410|CUMULATIVE_LIMIT_USAGE_END
08:02:32.062 (62539910)|CODE_UNIT_FINISHED|execute_anonymous_apex 08:02:32.064 (64041415)|EXECUTION_FINISHED
12. Print the all the contact First name & last name first alphabet in Capital letter. Ex: Contact>Fname’Sachin’ & LName>’arora’ Print => Sachin Arora
Click here to learn more
for(Contact con : conlist){
String fName=con.FirstName.substring(0,1).capitalize();
fName+=con.FirstName.substring(1,con.FirstName.length());
String lName=con.LastName.substring(0,1).capitalize();
lName+=con.LastName.substring(1,con.LastName.length());
system.debug(‘+++++++++++’ + fName + ‘++++++++++’ + lName);
}
13. To print the following series, 1 , (1+1)^2= 4 , (4+1)^2 =25 , (25+1)^2……
Click here to learn more
i=1;
for(l=1;l<3;l++)
{
k=i+1;
j=k.pow(2);
i=j;
system.debug(‘i+++++++++++’+ i);
}
Click here to learn more
02:44:29.783|CUMULATIVE_LIMIT_USAGE_END
02:44:29.040 (40490435)|CODE_UNIT_FINISHED|execute_anonymous_apex 02:44:29.041 (41930858)|EXECUTION_FINISHED
14. Print the Account Name in reverse order Ex: Name=’Company’ => ‘ynapmoC’
Click here to learn more
List<string> reverseList = new List<string>();
String nameToBeReversed= ” ;
for(Account acc: AccountList){
String test = acc.Name;
System.debug(‘account name++++++++++++’+acc.Name);
for (integer i = test.length(); i > =0; –i) {
if(test.substring(i).length() >1){
system.debug(test.substring(i).substring(0,1));
nameToBeReversed+=test.substring(i).substring(0,1);
}
else
{
nameToBeReversed+=test.substring(i); }
}
} system.debug(‘###########################’+nameToBeReversed);
Click here to learn more
07:32:55.507|CUMULATIVE_LIMIT_USAGE_END
07:32:55.054 (54376809)|CODE_UNIT_FINISHED|execute_anonymous_apex 07:32:55.055 (55575577)|EXECUTION_FINISHED
15. Print the fionacci series. 1, 1, 2, 3, 5, 8, 13..
Click here to learn more
i=j=1;
for(l=1;l<=7;l++)
{
system.debug(i);
k=i+j;
i=j;
j=k;
}
Click here to learn more
02:28:30.331|CUMULATIVE_LIMIT_USAGE_END
02:28:30.059 (59657409)|CODE_UNIT_FINISHED|execute_anonymous_apex 02:28:30.060 (60848486)|EXECUTION_FINISHED
16. Print any Integer number in reverse order. Ex: 789234 => 43298
Click here to learn more
while( n != 0 ){
reverse = reverse * 10;
reverse = reverse + math.mod(n,10);
n = n/10;
}
n = reverse;
system.debug(‘Reverse of entered number is ‘+ n);
Click here to learn more
05:12:08.492|CUMULATIVE_LIMIT_USAGE_END
05:12:08.035 (35094379)|CODE_UNIT_FINISHED|execute_anonymous_apex 05:12:08.036 (36553086)|EXECUTION_FINISHED
17. Find all the Products having Description field containing ‘a’ in it.
Click here to learn more
for(Product2 pro:ProductList){
string test = pro.Name;
system.debug(‘product Name++++++’+test);
}
Click here to learn more
00:04:41.673|CUMULATIVE_LIMIT_USAGE_END
00:04:41.038 (38814711)|CODE_UNIT_FINISHED|execute_anonymous_apex 00:04:41.040 (40169632)|EXECUTION_FINISHED
18. Create New Price book ‘Algo Pricebook’ and 10 Products with Prices in the Pricebook
Click here to learn more
insert customPB;
List<Product2> prod = new list<Product2>();
for(integer i=0;i<10;i++){
Product2 pro = new Product2(name = ‘test’+string.valueOF(i));
prod.add(pro);
}
insert prod;
list<Pricebookentry> pbeList = new list<Pricebookentry>();
for(Product2 pr: prod){
PricebookEntry a = new PricebookEntry(Pricebook2Id = customPB.Id,IsActive = true,unitPrice=2,product2Id
=pr.id);
pbeList.add(a);
}
insert pbelist;
September 22, 2016
Thank u So much Brother