Coding Genius (Apex Script)

1. Create 20 new Accounts Records in salesforce with at least 5 fields filled.

Click here to learn more

for(integer i=0;i<=20;i++)

{ 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

26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO Execute Anonymous: for(integer i=0;i<=20;i++) Execute Anonymous: { Execute Anonymous: Account a=new Account(); Execute Anonymous: Execute Anonymous: a.Name=’Name’ + i; Execute Anonymous: a.AccountNumber=’123′; Execute Anonymous: a.Rating=’Hot’; Execute Anonymous: a.Fax=’23456′; Execute Anonymous: a.Description=’xyz’; Execute Anonymous: Execute Anonymous: Execute Anonymous: insert a; Execute Anonymous: } Execute Anonymous: 03:02:01.043 (43535709)|EXECUTION_STARTED 03:02:01.043 (43550134)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 03:02:01.044 (44656206)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.133 (133648285)|DML_END|[12] 03:02:01.133 (133977923)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.156 (156160358)|DML_END|[12] 03:02:01.156 (156552645)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.181 (181065082)|DML_END|[12] 03:02:01.181 (181376111)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.211 (211480467)|DML_END|[12] 03:02:01.211 (211850928)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.233 (233992022)|DML_END|[12] 03:02:01.234 (234402707)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.259 (259710682)|DML_END|[12] 03:02:01.260 (260160914)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.300 (300922983)|DML_END|[12] 03:02:01.301 (301384284)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.326 (326875993)|DML_END|[12] 03:02:01.327 (327135983)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.349 (349535179)|DML_END|[12] 03:02:01.349 (349941227)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.375 (375003790)|DML_END|[12] 03:02:01.375 (375440112)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.412 (412150706)|DML_END|[12] 03:02:01.412 (412614410)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.436 (436155768)|DML_END|[12] 03:02:01.436 (436554875)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.463 (463390675)|DML_END|[12] 03:02:01.463 (463848073)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.504 (504413187)|DML_END|[12] 03:02:01.504 (504829506)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.553 (553646818)|DML_END|[12] 03:02:01.554 (554086660)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.616 (616412688)|DML_END|[12] 03:02:01.616 (616816078)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.650 (650602890)|DML_END|[12] 03:02:01.650 (650879727)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.677 (677108052)|DML_END|[12] 03:02:01.677 (677504489)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.707 (707638291)|DML_END|[12] 03:02:01.707 (707930971)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.731 (731984689)|DML_END|[12] 03:02:01.732 (732280707)|DML_BEGIN|[12]|Op:Insert|Type:Account|Rows:1 03:02:01.778 (778975043)|DML_END|[12] 03:02:01.909 (814148198)|CUMULATIVE_LIMIT_USAGE 03:02:01.909|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: 21 out of 150 Number of DML rows: 21 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 03:02:01.909|CUMULATIVE_LIMIT_USAGE_END 03:02:01.814 (814203174)|CODE_UNIT_FINISHED|execute_anonymous_apex

 

 2. Create 10 Contacts with diferent Account(LookUp) values(Relationship with no same 2 accounts) in them.

Click here to learn more

List<Account> accList= new List<Account>();

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: List<Account> accList= new List<Account>(); Execute Anonymous: accList = [SELECT Id,Name FROM Account LIMIT 20]; Execute Anonymous: List<Contact> conList=new List<Contact>(); Execute Anonymous: integer j =0; Execute Anonymous: for(integer i=1;i<10;i++){ Execute Anonymous: Execute Anonymous: j=j+1; Execute Anonymous: Contact con=new Contact(); Execute Anonymous: con.LastName= accList.get(j).Name; Execute Anonymous: con.AccountId=accList.get(j).Id; Execute Anonymous: Execute Anonymous: // accList.add(acc); Execute Anonymous: conList.add(con); Execute Anonymous: } Execute Anonymous: //Insert accList; Execute Anonymous: Insert conList; Execute Anonymous: 07:58:12.036 (36898151)|EXECUTION_STARTED 07:58:12.036 (36907501)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 07:58:12.037 (37547674)|SYSTEM_CONSTRUCTOR_ENTRY|[1]|<init>() 07:58:12.037 (37586098)|SYSTEM_CONSTRUCTOR_EXIT|[1]|<init>() 07:58:12.037 (37827388)|SOQL_EXECUTE_BEGIN|[2]|Aggregations:0|select Id, Name from Account limit 20 07:58:12.040 (40872534)|SOQL_EXECUTE_END|[2]|Rows:20 07:58:12.040 (40983260)|SYSTEM_CONSTRUCTOR_ENTRY|[3]|<init>() 07:58:12.041 (41004560)|SYSTEM_CONSTRUCTOR_EXIT|[3]|<init>() 07:58:12.041 (41174125)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41226850)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41308859)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41339580)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41418771)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.041 (41446685)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.041 (41483067)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41504287)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41563446)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41576846)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41635668)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.041 (41649355)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.041 (41681527)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41702321)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41752429)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41765426)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41820491)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.041 (41834030)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.041 (41866003)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41886360)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.041 (41936049)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.041 (41948901)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42004147)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42018411)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42050938)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42071675)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42121764)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42134817)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42189683)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42202967)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42234631)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42254938)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42304530)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42317199)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42371785)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42385178)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42416880)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42437965)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42487187)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42499933)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42561025)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42578781)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42613016)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42633670)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42683931)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42696731)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42751745)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42764988)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42796728)|SYSTEM_METHOD_ENTRY|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42817080)|SYSTEM_METHOD_EXIT|[9]|LIST<Account>.get(Integer) 07:58:12.042 (42866466)|SYSTEM_METHOD_ENTRY|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42880091)|SYSTEM_METHOD_EXIT|[10]|LIST<Account>.get(Integer) 07:58:12.042 (42935440)|SYSTEM_METHOD_ENTRY|[13]|LIST<Contact>.add(Object) 07:58:12.042 (42948697)|SYSTEM_METHOD_EXIT|[13]|LIST<Contact>.add(Object) 07:58:12.043 (43002828)|DML_BEGIN|[16]|Op:Insert|Type:Contact|Rows:9 07:58:12.121 (121007013)|DML_END|[16] 07:58:12.905 (153568477)|CUMULATIVE_LIMIT_USAGE 07:58:12.905|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 20 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 1 out of 150 Number of DML rows: 9 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: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

list<opportunity> opp1=new list<opportunity>();

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO

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

list<Product2> pro1=new list<Product2>();

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO

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

list<Contact>ContactList = [SELECT Id FROM Contact WHERE Account.Name like ‘%a%’];

delete Contactlist;

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO

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

list<opportunity>oppList = [SELECT Id FROM opportunity WHERE CloseDate<Today];

delete opplist;

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO

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> oppList=[SELECT Name,CloseDate FROM Opportunity WHERE CloseDate>TODAY];

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: LIST<opportunity> oppList=[SELECT Name,CloseDate FROM Opportunity WHERE CloseDate>TODAY]; Execute Anonymous: LIST<opportunity> oppList1=new LIST<opportunity>(); Execute Anonymous: for(Opportunity opp:oppList){ Execute Anonymous: opp.Name=opp.Name+’F’; Execute Anonymous: oppList1.add(opp); Execute Anonymous: system.debug(‘++++++++++++++’+opp); Execute Anonymous: } Execute Anonymous: update oppList; Execute Anonymous: Execute Anonymous: 07:57:12.034 (34144711)|EXECUTION_STARTED 07:57:12.034 (34155804)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 07:57:12.035 (35056991)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select Name, CloseDate from Opportunity where CloseDate > TODAY 07:57:12.038 (38516906)|SOQL_EXECUTE_END|[1]|Rows:2 07:57:12.038 (38629211)|SYSTEM_CONSTRUCTOR_ENTRY|[2]|<init>() 07:57:12.038 (38660306)|SYSTEM_CONSTRUCTOR_EXIT|[2]|<init>() 07:57:12.038 (38687652)|SYSTEM_METHOD_ENTRY|[3]|LIST<Opportunity>.iterator() 07:57:12.038 (38827583)|SYSTEM_METHOD_EXIT|[3]|LIST<Opportunity>.iterator() 07:57:12.038 (38858160)|SYSTEM_METHOD_ENTRY|[3]|system.ListIterator.hasNext() 07:57:12.038 (38885146)|SYSTEM_METHOD_EXIT|[3]|system.ListIterator.hasNext() 07:57:12.039 (39017373)|SYSTEM_METHOD_ENTRY|[5]|LIST<Opportunity>.add(Object) 07:57:12.039 (39046620)|SYSTEM_METHOD_EXIT|[5]|LIST<Opportunity>.add(Object) 07:57:12.039 (39082190)|SYSTEM_METHOD_ENTRY|[6]|String.valueOf(Object) 07:57:12.039 (39150920)|SYSTEM_METHOD_EXIT|[6]|String.valueOf(Object) 07:57:12.039 (39175289)|SYSTEM_METHOD_ENTRY|[6]|System.debug(ANY) 07:57:12.039 (39185484)|USER_DEBUG|[6]|DEBUG|++++++++++++++Opportunity:{Name=aroraF, Id=0069000000LcxmQAAR, CloseDate=2014-08-22 00:00:00} 07:57:12.039 (39192131)|SYSTEM_METHOD_EXIT|[6]|System.debug(ANY) 07:57:12.039 (39200586)|SYSTEM_METHOD_ENTRY|[3]|system.ListIterator.hasNext() 07:57:12.039 (39213571)|SYSTEM_METHOD_EXIT|[3]|system.ListIterator.hasNext() 07:57:12.039 (39286587)|SYSTEM_METHOD_ENTRY|[5]|LIST<Opportunity>.add(Object) 07:57:12.039 (39302114)|SYSTEM_METHOD_EXIT|[5]|LIST<Opportunity>.add(Object) 07:57:12.039 (39318709)|SYSTEM_METHOD_ENTRY|[6]|String.valueOf(Object) 07:57:12.039 (39374986)|SYSTEM_METHOD_EXIT|[6]|String.valueOf(Object) 07:57:12.039 (39389782)|SYSTEM_METHOD_ENTRY|[6]|System.debug(ANY) 07:57:12.039 (39396771)|USER_DEBUG|[6]|DEBUG|++++++++++++++Opportunity:{Name=sachin pvt.ltd-F, Id=0069000000LcxkFAAR, CloseDate=2014-09-30 00:00:00} 07:57:12.039 (39402811)|SYSTEM_METHOD_EXIT|[6]|System.debug(ANY) 07:57:12.039 (39410992)|SYSTEM_METHOD_ENTRY|[3]|system.ListIterator.hasNext() 07:57:12.039 (39423794)|SYSTEM_METHOD_EXIT|[3]|system.ListIterator.hasNext() 07:57:12.039 (39471611)|DML_BEGIN|[8]|Op:Update|Type:Opportunity|Rows:2 07:57:12.256 (256354158)|DML_END|[8] 07:57:12.715 (336324376)|CUMULATIVE_LIMIT_USAGE 07:57:12.715|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 2 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 1 out of 150 Number of DML rows: 2 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: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 with sharing class WelcomeClass {

public void test(){

system.debug(‘Welcome to sales force’); } }

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: Welcome w=new Welcome(); Execute Anonymous: w.printWelcome(); 06:36:09.067 (67951192)|EXECUTION_STARTED 06:36:09.067 (67961006)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 06:36:09.072 (72602586)|METHOD_ENTRY|[1]|01p9000000584Eo|Welcome.Welcome() 06:36:09.072 (72693893)|SYSTEM_MODE_ENTER|false 06:36:09.072 (72703654)|SYSTEM_MODE_EXIT|false 06:36:09.072 (72713583)|METHOD_EXIT|[1]|Welcome 06:36:09.072 (72757720)|SYSTEM_MODE_ENTER|false 06:36:09.072 (72792974)|CONSTRUCTOR_ENTRY|[1]|01p9000000584Eo|<init>() 06:36:09.072 (72846166)|CONSTRUCTOR_EXIT|[1]|01p9000000584Eo|<init>() 06:36:09.072 (72851654)|SYSTEM_MODE_EXIT|false 06:36:09.072 (72881404)|SYSTEM_MODE_ENTER|false 06:36:09.072 (72924908)|METHOD_ENTRY|[2]|01p9000000584Eo|Welcome.printWelcome() 06:36:09.072 (72985842)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 06:36:09.073 (73022379)|USER_DEBUG|[5]|DEBUG|Welcome to Salesforce 06:36:09.073 (73033406)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 06:36:09.073 (73043150)|METHOD_EXIT|[2]|01p9000000584Eo|Welcome.printWelcome() 06:36:09.073 (73047502)|SYSTEM_MODE_EXIT|false 06:36:09.283 (73086378)|CUMULATIVE_LIMIT_USAGE 06:36:09.283|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: 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

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

26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO Execute Anonymous: System.debug(‘welcome to salesforce’); 04:36:43.040 (40895510)|EXECUTION_STARTED 04:36:43.040 (40904460)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 04:36:43.041 (41382733)|USER_DEBUG|[1]|DEBUG|welcome to salesforce 04:36:43.181 (41430674)|CUMULATIVE_LIMIT_USAGE 04:36:43.181|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: 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

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

user u = [Select MobilePhone,Name, Email from user where id =: UserInfo.getUserId() ];

system.debug(‘>>>>>>>>>>>>’+u.MobilePhone+’>>>>>>>’+u.Name+’>>>’+u.Email);

 

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: Execute Anonymous: user u = [Select MobilePhone,Name, Email from user where id =: UserInfo.getUserId() ]; Execute Anonymous: system.debug(‘>>>>>>>>>>>>’+u.MobilePhone+’>>>>>>>’+u.Name+’>>>’+u.Email); 04:39:09.038 (38902978)|EXECUTION_STARTED 04:39:09.038 (38914434)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 04:39:09.039 (39471856)|SYSTEM_MODE_ENTER|false 04:39:09.039 (39586503)|SYSTEM_METHOD_ENTRY|[2]|system.UserInfo.getUserId() 04:39:09.039 (39640851)|SYSTEM_METHOD_EXIT|[2]|system.UserInfo.getUserId() 04:39:09.039 (39649781)|SYSTEM_MODE_EXIT|false 04:39:09.039 (39879038)|SOQL_EXECUTE_BEGIN|[2]|Aggregations:0|select MobilePhone, Name, Email from user where id = :tmpVar1 04:39:09.042 (42722019)|SOQL_EXECUTE_END|[2]|Rows:1 04:39:09.043 (43028464)|SYSTEM_METHOD_ENTRY|[3]|System.debug(ANY) 04:39:09.043 (43057936)|USER_DEBUG|[3]|DEBUG|>>>>>>>>>>>>+91971 604-9567>>>>>>>Sachin Arora>>>sachin.arora1650@gmail.com 04:39:09.043 (43068351)|SYSTEM_METHOD_EXIT|[3]|System.debug(ANY) 04:39:09.131 (43107155)|CUMULATIVE_LIMIT_USAGE 04:39:09.131|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 1 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

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

Account[] acc = [SELECT Name FROM Account ORDER BY Name ASC ] ;

for(integer i=0;i<acc.size();i++){

Account a=acc[i];

system.debug(‘+++++++++++++’+a.Name);

}

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: Account[] acc = [SELECT Name FROM Account ORDER BY Name ASC ] ; Execute Anonymous: for(integer i=0;i<acc.size();i++){ Execute Anonymous: Account a=acc[i]; Execute Anonymous: system.debug(‘+++++++++++++’+a.Name); Execute Anonymous: } 08:02:32.037 (37710526)|EXECUTION_STARTED 08:02:32.037 (37724844)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 08:02:32.038 (38830708)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select Name from Account order by Name 08:02:32.059 (59021128)|SOQL_EXECUTE_END|[1]|Rows:49 08:02:32.059 (59292845)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59334152)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59466359)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59493695)|USER_DEBUG|[4]|DEBUG|+++++++++++++abhimanyu 08:02:32.059 (59501598)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59514273)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59522568)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59556578)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59564371)|USER_DEBUG|[4]|DEBUG|+++++++++++++amit kumar 08:02:32.059 (59570186)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59578801)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59585573)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59612433)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59619604)|USER_DEBUG|[4]|DEBUG|+++++++++++++assdadsa 08:02:32.059 (59625175)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59634058)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59640845)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59667043)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59674207)|USER_DEBUG|[4]|DEBUG|+++++++++++++Burlington Textiles Corp of America 08:02:32.059 (59680150)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59695158)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59702967)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59731803)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59739080)|USER_DEBUG|[4]|DEBUG|+++++++++++++dadadadadad 08:02:32.059 (59744534)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59753205)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59759974)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59786491)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59793679)|USER_DEBUG|[4]|DEBUG|+++++++++++++dadasdasd 08:02:32.059 (59799298)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59807871)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59814527)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59840175)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59847176)|USER_DEBUG|[4]|DEBUG|+++++++++++++dasdsada 08:02:32.059 (59852452)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59860755)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59867743)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59893552)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59900885)|USER_DEBUG|[4]|DEBUG|+++++++++++++Dickenson plc 08:02:32.059 (59906393)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59914720)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59921413)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.059 (59946764)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.059 (59953958)|USER_DEBUG|[4]|DEBUG|+++++++++++++Edge Communications 08:02:32.059 (59959393)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.059 (59967830)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.059 (59974571)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60000136)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60008136)|USER_DEBUG|[4]|DEBUG|+++++++++++++Express Logistics and Transport 08:02:32.060 (60013723)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60022447)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60034936)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60063945)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60075199)|USER_DEBUG|[4]|DEBUG|+++++++++++++GenePoint 08:02:32.060 (60081363)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60090175)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60097049)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60125136)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60132305)|USER_DEBUG|[4]|DEBUG|+++++++++++++Grand Hotels & Resorts Ltd 08:02:32.060 (60137993)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60146501)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60153288)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60179251)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60186305)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 0 08:02:32.060 (60191492)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60199782)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60207137)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60232974)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60240106)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 1 08:02:32.060 (60245506)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60253945)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60260763)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60318540)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60331683)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 10 08:02:32.060 (60342187)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60358453)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60370501)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60420614)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60432554)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 11 08:02:32.060 (60441494)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60455502)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60467188)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60512861)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60525538)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 12 08:02:32.060 (60535859)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60552079)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60564296)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60612075)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60623465)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 13 08:02:32.060 (60632611)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60647340)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60658451)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60714025)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60726305)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 14 08:02:32.060 (60736513)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60753301)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60766268)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60814742)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60825628)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 15 08:02:32.060 (60834171)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60849082)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60861104)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60902745)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60911324)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 16 08:02:32.060 (60917138)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60926652)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60933620)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.060 (60961529)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.060 (60968634)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 17 08:02:32.060 (60973968)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.060 (60982488)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.060 (60989118)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61016144)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61024210)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 18 08:02:32.061 (61029535)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61038165)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61044890)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61071555)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61078524)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 19 08:02:32.061 (61083771)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61092104)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61098879)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61124822)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61131805)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 2 08:02:32.061 (61137228)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61145769)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61152471)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61178600)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61185674)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 3 08:02:32.061 (61190932)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61199242)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61205805)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61231326)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61238359)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 4 08:02:32.061 (61243595)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61251925)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61258547)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61284099)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61291040)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 5 08:02:32.061 (61296300)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61304601)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61311196)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61336645)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61343872)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 6 08:02:32.061 (61349213)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61357576)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61364297)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61390143)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61397201)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 7 08:02:32.061 (61402549)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61410919)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61417584)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61443196)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61450285)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 8 08:02:32.061 (61455512)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61463799)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61470437)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61495934)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61503211)|USER_DEBUG|[4]|DEBUG|+++++++++++++Name 9 08:02:32.061 (61508566)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61517082)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61523790)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61549638)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61556724)|USER_DEBUG|[4]|DEBUG|+++++++++++++Pyramid Construction Inc. 08:02:32.061 (61562366)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61570642)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61577365)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61603197)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61610152)|USER_DEBUG|[4]|DEBUG|+++++++++++++sachin 08:02:32.061 (61615449)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61623777)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61630469)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61656347)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61663768)|USER_DEBUG|[4]|DEBUG|+++++++++++++sachin pvt.ltd 08:02:32.061 (61669337)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61677750)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61684487)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61726964)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61734515)|USER_DEBUG|[4]|DEBUG|+++++++++++++sForce 08:02:32.061 (61740079)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61748838)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61755517)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61781796)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61788882)|USER_DEBUG|[4]|DEBUG|+++++++++++++test1 08:02:32.061 (61794278)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61802675)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61809452)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61835332)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61842648)|USER_DEBUG|[4]|DEBUG|+++++++++++++test1 08:02:32.061 (61848194)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61856517)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61863305)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61889100)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61896102)|USER_DEBUG|[4]|DEBUG|+++++++++++++test1 08:02:32.061 (61901353)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61909598)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61916227)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61941868)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.061 (61948851)|USER_DEBUG|[4]|DEBUG|+++++++++++++test1 08:02:32.061 (61954153)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.061 (61962423)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.061 (61969077)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.061 (61994813)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62001941)|USER_DEBUG|[4]|DEBUG|+++++++++++++test2 08:02:32.062 (62008349)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62016902)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62023630)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62049495)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62056592)|USER_DEBUG|[4]|DEBUG|+++++++++++++test2 08:02:32.062 (62062002)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62070282)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62076943)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62102805)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62109924)|USER_DEBUG|[4]|DEBUG|+++++++++++++test2 08:02:32.062 (62115150)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62123340)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62130029)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62155596)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62162450)|USER_DEBUG|[4]|DEBUG|+++++++++++++test2 08:02:32.062 (62168071)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62176391)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62183077)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62208833)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62215920)|USER_DEBUG|[4]|DEBUG|+++++++++++++udit 08:02:32.062 (62221384)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62229556)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62236280)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62262077)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62269225)|USER_DEBUG|[4]|DEBUG|+++++++++++++United Oil & Gas Corp. 08:02:32.062 (62274904)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62283460)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62290149)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62316222)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62323472)|USER_DEBUG|[4]|DEBUG|+++++++++++++United Oil & Gas, Singapore 08:02:32.062 (62329528)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62338147)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62344872)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62370697)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62377781)|USER_DEBUG|[4]|DEBUG|+++++++++++++United Oil & Gas, UK 08:02:32.062 (62383359)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62391720)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62398482)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.062 (62424251)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 08:02:32.062 (62431159)|USER_DEBUG|[4]|DEBUG|+++++++++++++University of Arizona 08:02:32.062 (62436752)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 08:02:32.062 (62445341)|SYSTEM_METHOD_ENTRY|[2]|LIST<Account>.size() 08:02:32.062 (62451997)|SYSTEM_METHOD_EXIT|[2]|LIST<Account>.size() 08:02:32.410 (62512281)|CUMULATIVE_LIMIT_USAGE 08:02:32.410|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 49 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

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

list<contact> conlist = [SELECT FirstName,LastName FROM Contact WHERE FirstName!=Null ];

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

decimal i,j,k,l;

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: decimal i,j,k,l; Execute Anonymous: i=1; Execute Anonymous: for(l=1;l<3;l++) Execute Anonymous: { Execute Anonymous: k=i+1; Execute Anonymous: j=k.pow(2); Execute Anonymous: i=j; Execute Anonymous: system.debug(‘i+++++++++++’+ i); Execute Anonymous: } 02:44:29.039 (39169618)|EXECUTION_STARTED 02:44:29.039 (39179375)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 02:44:29.039 (39785070)|SYSTEM_METHOD_ENTRY|[3]|Decimal.compareTo(Decimal) 02:44:29.039 (39822197)|SYSTEM_METHOD_EXIT|[3]|Decimal.compareTo(Decimal) 02:44:29.039 (39864010)|SYSTEM_METHOD_ENTRY|[5]|Decimal.add(Decimal) 02:44:29.039 (39895763)|SYSTEM_METHOD_EXIT|[5]|Decimal.add(Decimal) 02:44:29.039 (39917915)|SYSTEM_METHOD_ENTRY|[6]|Decimal.pow(Integer) 02:44:29.039 (39958147)|SYSTEM_METHOD_EXIT|[6]|Decimal.pow(Integer) 02:44:29.040 (40006227)|SYSTEM_METHOD_ENTRY|[8]|String.valueOf(Object) 02:44:29.040 (40038083)|SYSTEM_METHOD_EXIT|[8]|String.valueOf(Object) 02:44:29.040 (40112993)|SYSTEM_METHOD_ENTRY|[8]|System.debug(ANY) 02:44:29.040 (40126294)|USER_DEBUG|[8]|DEBUG|i+++++++++++4 02:44:29.040 (40133606)|SYSTEM_METHOD_EXIT|[8]|System.debug(ANY) 02:44:29.040 (40161000)|SYSTEM_METHOD_ENTRY|[3]|Decimal.add(Decimal) 02:44:29.040 (40177503)|SYSTEM_METHOD_EXIT|[3]|Decimal.add(Decimal) 02:44:29.040 (40199762)|SYSTEM_METHOD_ENTRY|[3]|Decimal.compareTo(Decimal) 02:44:29.040 (40211957)|SYSTEM_METHOD_EXIT|[3]|Decimal.compareTo(Decimal) 02:44:29.040 (40231379)|SYSTEM_METHOD_ENTRY|[5]|Decimal.add(Decimal) 02:44:29.040 (40246292)|SYSTEM_METHOD_EXIT|[5]|Decimal.add(Decimal) 02:44:29.040 (40260955)|SYSTEM_METHOD_ENTRY|[6]|Decimal.pow(Integer) 02:44:29.040 (40284648)|SYSTEM_METHOD_EXIT|[6]|Decimal.pow(Integer) 02:44:29.040 (40303932)|SYSTEM_METHOD_ENTRY|[8]|String.valueOf(Object) 02:44:29.040 (40319655)|SYSTEM_METHOD_EXIT|[8]|String.valueOf(Object) 02:44:29.040 (40331433)|SYSTEM_METHOD_ENTRY|[8]|System.debug(ANY) 02:44:29.040 (40338152)|USER_DEBUG|[8]|DEBUG|i+++++++++++25 02:44:29.040 (40343506)|SYSTEM_METHOD_EXIT|[8]|System.debug(ANY) 02:44:29.040 (40365492)|SYSTEM_METHOD_ENTRY|[3]|Decimal.add(Decimal) 02:44:29.040 (40381298)|SYSTEM_METHOD_EXIT|[3]|Decimal.add(Decimal) 02:44:29.040 (40401233)|SYSTEM_METHOD_ENTRY|[3]|Decimal.compareTo(Decimal) 02:44:29.040 (40413149)|SYSTEM_METHOD_EXIT|[3]|Decimal.compareTo(Decimal) 02:44:29.783 (40453901)|CUMULATIVE_LIMIT_USAGE 02:44:29.783|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: 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

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<Account> AccountList = [select Name from Account limit 1];

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: List<Account> AccountList = [select Name from Account limit 1]; Execute Anonymous: List<string> reverseList = new List<string>(); Execute Anonymous: Execute Anonymous: String nameToBeReversed= ” ; Execute Anonymous: for(Account acc: AccountList){ Execute Anonymous: String test = acc.Name; Execute Anonymous: System.debug(‘account name++++++++++++’+acc.Name); Execute Anonymous: Execute Anonymous: for (integer i = test.length(); i > =0; –i) { Execute Anonymous: if(test.substring(i).length() >1){ Execute Anonymous: system.debug(test.substring(i).substring(0,1)); Execute Anonymous: nameToBeReversed+=test.substring(i).substring(0,1); Execute Anonymous: }else{ Execute Anonymous: nameToBeReversed+=test.substring(i); Execute Anonymous: } Execute Anonymous: Execute Anonymous: } Execute Anonymous: Execute Anonymous: } Execute Anonymous: system.debug(‘###########################’+nameToBeReversed); Execute Anonymous: Execute Anonymous: Execute Anonymous: 07:32:55.047 (47612747)|EXECUTION_STARTED 07:32:55.047 (47623713)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 07:32:55.048 (48519976)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select Name from Account limit 1 07:32:55.052 (52957813)|SOQL_EXECUTE_END|[1]|Rows:1 07:32:55.053 (53035417)|SYSTEM_CONSTRUCTOR_ENTRY|[2]|<init>() 07:32:55.053 (53062717)|SYSTEM_CONSTRUCTOR_EXIT|[2]|<init>() 07:32:55.053 (53133412)|SYSTEM_METHOD_ENTRY|[5]|LIST<Account>.iterator() 07:32:55.053 (53277029)|SYSTEM_METHOD_EXIT|[5]|LIST<Account>.iterator() 07:32:55.053 (53309381)|SYSTEM_METHOD_ENTRY|[5]|system.ListIterator.hasNext() 07:32:55.053 (53337489)|SYSTEM_METHOD_EXIT|[5]|system.ListIterator.hasNext() 07:32:55.053 (53437739)|SYSTEM_METHOD_ENTRY|[7]|System.debug(ANY) 07:32:55.053 (53457483)|USER_DEBUG|[7]|DEBUG|account name++++++++++++udit 07:32:55.053 (53464432)|SYSTEM_METHOD_EXIT|[7]|System.debug(ANY) 07:32:55.053 (53494098)|SYSTEM_METHOD_ENTRY|[9]|String.length() 07:32:55.053 (53521179)|SYSTEM_METHOD_EXIT|[9]|String.length() 07:32:55.053 (53542409)|SYSTEM_METHOD_ENTRY|[10]|String.substring(Integer) 07:32:55.053 (53565286)|SYSTEM_METHOD_EXIT|[10]|String.substring(Integer) 07:32:55.053 (53576038)|SYSTEM_METHOD_ENTRY|[10]|String.length() 07:32:55.053 (53585467)|SYSTEM_METHOD_EXIT|[10]|String.length() 07:32:55.053 (53600412)|SYSTEM_METHOD_ENTRY|[14]|String.substring(Integer) 07:32:55.053 (53619921)|SYSTEM_METHOD_EXIT|[14]|String.substring(Integer) 07:32:55.053 (53648136)|SYSTEM_METHOD_ENTRY|[10]|String.substring(Integer) 07:32:55.053 (53662443)|SYSTEM_METHOD_EXIT|[10]|String.substring(Integer) 07:32:55.053 (53671876)|SYSTEM_METHOD_ENTRY|[10]|String.length() 07:32:55.053 (53681285)|SYSTEM_METHOD_EXIT|[10]|String.length() 07:32:55.053 (53693906)|SYSTEM_METHOD_ENTRY|[14]|String.substring(Integer) 07:32:55.053 (53705344)|SYSTEM_METHOD_EXIT|[14]|String.substring(Integer) 07:32:55.053 (53721366)|SYSTEM_METHOD_ENTRY|[10]|String.substring(Integer) 07:32:55.053 (53733497)|SYSTEM_METHOD_EXIT|[10]|String.substring(Integer) 07:32:55.053 (53742614)|SYSTEM_METHOD_ENTRY|[10]|String.length() 07:32:55.053 (53751828)|SYSTEM_METHOD_EXIT|[10]|String.length() 07:32:55.053 (53763618)|SYSTEM_METHOD_ENTRY|[11]|String.substring(Integer) 07:32:55.053 (53784391)|SYSTEM_METHOD_EXIT|[11]|String.substring(Integer) 07:32:55.053 (53800792)|SYSTEM_METHOD_ENTRY|[11]|String.substring(Integer, Integer) 07:32:55.053 (53815276)|SYSTEM_METHOD_EXIT|[11]|String.substring(Integer, Integer) 07:32:55.053 (53830960)|SYSTEM_METHOD_ENTRY|[11]|System.debug(ANY) 07:32:55.053 (53837987)|USER_DEBUG|[11]|DEBUG|i 07:32:55.053 (53843675)|SYSTEM_METHOD_EXIT|[11]|System.debug(ANY) 07:32:55.053 (53859566)|SYSTEM_METHOD_ENTRY|[12]|String.substring(Integer) 07:32:55.053 (53880909)|SYSTEM_METHOD_EXIT|[12]|String.substring(Integer) 07:32:55.053 (53894803)|SYSTEM_METHOD_ENTRY|[12]|String.substring(Integer, Integer) 07:32:55.053 (53916136)|SYSTEM_METHOD_EXIT|[12]|String.substring(Integer, Integer) 07:32:55.053 (53936663)|SYSTEM_METHOD_ENTRY|[10]|String.substring(Integer) 07:32:55.053 (53948984)|SYSTEM_METHOD_EXIT|[10]|String.substring(Integer) 07:32:55.053 (53957940)|SYSTEM_METHOD_ENTRY|[10]|String.length() 07:32:55.053 (53967263)|SYSTEM_METHOD_EXIT|[10]|String.length() 07:32:55.053 (53978883)|SYSTEM_METHOD_ENTRY|[11]|String.substring(Integer) 07:32:55.053 (53990192)|SYSTEM_METHOD_EXIT|[11]|String.substring(Integer) 07:32:55.054 (54001785)|SYSTEM_METHOD_ENTRY|[11]|String.substring(Integer, Integer) 07:32:55.054 (54015029)|SYSTEM_METHOD_EXIT|[11]|String.substring(Integer, Integer) 07:32:55.054 (54023325)|SYSTEM_METHOD_ENTRY|[11]|System.debug(ANY) 07:32:55.054 (54029452)|USER_DEBUG|[11]|DEBUG|d 07:32:55.054 (54034798)|SYSTEM_METHOD_EXIT|[11]|System.debug(ANY) 07:32:55.054 (54047533)|SYSTEM_METHOD_ENTRY|[12]|String.substring(Integer) 07:32:55.054 (54059728)|SYSTEM_METHOD_EXIT|[12]|String.substring(Integer) 07:32:55.054 (54071696)|SYSTEM_METHOD_ENTRY|[12]|String.substring(Integer, Integer) 07:32:55.054 (54083916)|SYSTEM_METHOD_EXIT|[12]|String.substring(Integer, Integer) 07:32:55.054 (54100646)|SYSTEM_METHOD_ENTRY|[10]|String.substring(Integer) 07:32:55.054 (54112627)|SYSTEM_METHOD_EXIT|[10]|String.substring(Integer) 07:32:55.054 (54121519)|SYSTEM_METHOD_ENTRY|[10]|String.length() 07:32:55.054 (54130786)|SYSTEM_METHOD_EXIT|[10]|String.length() 07:32:55.054 (54141875)|SYSTEM_METHOD_ENTRY|[11]|String.substring(Integer) 07:32:55.054 (54153323)|SYSTEM_METHOD_EXIT|[11]|String.substring(Integer) 07:32:55.054 (54164770)|SYSTEM_METHOD_ENTRY|[11]|String.substring(Integer, Integer) 07:32:55.054 (54177128)|SYSTEM_METHOD_EXIT|[11]|String.substring(Integer, Integer) 07:32:55.054 (54184832)|SYSTEM_METHOD_ENTRY|[11]|System.debug(ANY) 07:32:55.054 (54190619)|USER_DEBUG|[11]|DEBUG|u 07:32:55.054 (54195678)|SYSTEM_METHOD_EXIT|[11]|System.debug(ANY) 07:32:55.054 (54207566)|SYSTEM_METHOD_ENTRY|[12]|String.substring(Integer) 07:32:55.054 (54219459)|SYSTEM_METHOD_EXIT|[12]|String.substring(Integer) 07:32:55.054 (54231399)|SYSTEM_METHOD_ENTRY|[12]|String.substring(Integer, Integer) 07:32:55.054 (54243883)|SYSTEM_METHOD_EXIT|[12]|String.substring(Integer, Integer) 07:32:55.054 (54258022)|SYSTEM_METHOD_ENTRY|[5]|system.ListIterator.hasNext() 07:32:55.054 (54272283)|SYSTEM_METHOD_EXIT|[5]|system.ListIterator.hasNext() 07:32:55.054 (54292349)|SYSTEM_METHOD_ENTRY|[20]|System.debug(ANY) 07:32:55.054 (54304633)|USER_DEBUG|[20]|DEBUG|###########################tidu 07:32:55.054 (54310744)|SYSTEM_METHOD_EXIT|[20]|System.debug(ANY) 07:32:55.507 (54352075)|CUMULATIVE_LIMIT_USAGE 07:32:55.507|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 1 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: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

integer i,j,k,l,m;

i=j=1;

for(l=1;l<=7;l++)

{

system.debug(i);

k=i+j;

i=j;

j=k;

}

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: integer i,j,k,l,m; Execute Anonymous: i=j=1; Execute Anonymous: for(l=1;l<=7;l++) Execute Anonymous: { Execute Anonymous: system.debug(i); Execute Anonymous: k=i+j; Execute Anonymous: i=j; Execute Anonymous: j=k; Execute Anonymous: } 02:28:30.058 (58885653)|EXECUTION_STARTED 02:28:30.058 (58897005)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 02:28:30.059 (59391681)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59440020)|USER_DEBUG|[5]|DEBUG|1 02:28:30.059 (59450089)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.059 (59470741)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59477109)|USER_DEBUG|[5]|DEBUG|1 02:28:30.059 (59481960)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.059 (59492765)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59498150)|USER_DEBUG|[5]|DEBUG|2 02:28:30.059 (59502710)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.059 (59513308)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59518592)|USER_DEBUG|[5]|DEBUG|3 02:28:30.059 (59523175)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.059 (59533204)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59538525)|USER_DEBUG|[5]|DEBUG|5 02:28:30.059 (59543022)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.059 (59553176)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59558439)|USER_DEBUG|[5]|DEBUG|8 02:28:30.059 (59568966)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.059 (59580098)|SYSTEM_METHOD_ENTRY|[5]|System.debug(ANY) 02:28:30.059 (59585712)|USER_DEBUG|[5]|DEBUG|13 02:28:30.059 (59590441)|SYSTEM_METHOD_EXIT|[5]|System.debug(ANY) 02:28:30.331 (59632689)|CUMULATIVE_LIMIT_USAGE 02:28:30.331|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: 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

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

integer n = 12345, reverse = 0;

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

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: Execute Anonymous: integer n = 12345, reverse = 0; Execute Anonymous: while( n != 0 ) Execute Anonymous: { Execute Anonymous: reverse = reverse * 10; Execute Anonymous: reverse = reverse + math.mod(n,10); Execute Anonymous: n = n/10; Execute Anonymous: } Execute Anonymous: n = reverse; Execute Anonymous: system.debug(‘Reverse of entered number is ‘+ n); 05:12:08.033 (33923879)|EXECUTION_STARTED 05:12:08.033 (33934280)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 05:12:08.034 (34447575)|SYSTEM_MODE_ENTER|false 05:12:08.034 (34546776)|SYSTEM_METHOD_ENTRY|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34632828)|SYSTEM_METHOD_EXIT|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34645717)|SYSTEM_MODE_EXIT|false 05:12:08.034 (34668005)|SYSTEM_MODE_ENTER|false 05:12:08.034 (34686352)|SYSTEM_METHOD_ENTRY|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34710844)|SYSTEM_METHOD_EXIT|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34718708)|SYSTEM_MODE_EXIT|false 05:12:08.034 (34734495)|SYSTEM_MODE_ENTER|false 05:12:08.034 (34748946)|SYSTEM_METHOD_ENTRY|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34771008)|SYSTEM_METHOD_EXIT|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34778444)|SYSTEM_MODE_EXIT|false 05:12:08.034 (34793403)|SYSTEM_MODE_ENTER|false 05:12:08.034 (34807235)|SYSTEM_METHOD_ENTRY|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34828921)|SYSTEM_METHOD_EXIT|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34836146)|SYSTEM_MODE_EXIT|false 05:12:08.034 (34850861)|SYSTEM_MODE_ENTER|false 05:12:08.034 (34864650)|SYSTEM_METHOD_ENTRY|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34886098)|SYSTEM_METHOD_EXIT|[6]|system.Math.mod(Integer, Integer) 05:12:08.034 (34893161)|SYSTEM_MODE_EXIT|false 05:12:08.034 (34944556)|SYSTEM_METHOD_ENTRY|[10]|String.valueOf(Object) 05:12:08.034 (34979029)|SYSTEM_METHOD_EXIT|[10]|String.valueOf(Object) 05:12:08.035 (35011132)|SYSTEM_METHOD_ENTRY|[10]|System.debug(ANY) 05:12:08.035 (35022990)|USER_DEBUG|[10]|DEBUG|Reverse of entered number is 54321 05:12:08.035 (35029848)|SYSTEM_METHOD_EXIT|[10]|System.debug(ANY) 05:12:08.492 (35068978)|CUMULATIVE_LIMIT_USAGE 05:12:08.492|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: 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

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

List<Product2>productList=[select Name,Description from Product2 WHERE Description like ‘%a%’];

for(Product2 pro:ProductList){

string test = pro.Name;

system.debug(‘product Name++++++’+test);

}

Click here to learn more

31.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO Execute Anonymous: List<Product2>productList=[select Name,Description from Product2 WHERE Description like ‘%a%’]; Execute Anonymous: for(Product2 pro:ProductList){ Execute Anonymous: string test = pro.Name; Execute Anonymous: system.debug(‘product Name++++++’+test); Execute Anonymous: Execute Anonymous: } Execute Anonymous: 00:04:41.034 (34388017)|EXECUTION_STARTED 00:04:41.034 (34398475)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 00:04:41.035 (35362403)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select Name, Description from Product2 where Description like ‘%a%’ 00:04:41.038 (38263594)|SOQL_EXECUTE_END|[1]|Rows:1 00:04:41.038 (38388298)|SYSTEM_METHOD_ENTRY|[2]|LIST<Product2>.iterator() 00:04:41.038 (38533332)|SYSTEM_METHOD_EXIT|[2]|LIST<Product2>.iterator() 00:04:41.038 (38565185)|SYSTEM_METHOD_ENTRY|[2]|system.ListIterator.hasNext() 00:04:41.038 (38593052)|SYSTEM_METHOD_EXIT|[2]|system.ListIterator.hasNext() 00:04:41.038 (38691565)|SYSTEM_METHOD_ENTRY|[4]|System.debug(ANY) 00:04:41.038 (38716196)|USER_DEBUG|[4]|DEBUG|product Name++++++GenWatt Diesel 200kW 00:04:41.038 (38728190)|SYSTEM_METHOD_EXIT|[4]|System.debug(ANY) 00:04:41.038 (38737866)|SYSTEM_METHOD_ENTRY|[2]|system.ListIterator.hasNext() 00:04:41.038 (38753108)|SYSTEM_METHOD_EXIT|[2]|system.ListIterator.hasNext() 00:04:41.673 (38791573)|CUMULATIVE_LIMIT_USAGE 00:04:41.673|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 1 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

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

Pricebook2 customPB = new Pricebook2(name =’AlgoworksTest’,isActive=true);

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;

 

Author: AJ

Share This Post On

1 Comment

  1. Thank u So much Brother

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

× How can I help you?