Posted by AJ on May 19, 2015
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:...
Read more
Recent Comments