// lists the associated tasks to the Incident
public List<BMCServiceDesk__Task__c> tasks {get; set;}
public String[] records {get;set;}
public IncidentTask(ApexPages.StandardController stdCtrl)
{
std=stdCtrl;
tasks=[select id, Name, Subject__c, Model__c, CMDB_Model__c, BMCServiceDesk__FKIncident__c, BMCServiceDesk__FKStatus__c, Tracking_Number__c, Asset_Tag__c, Serial_Number__c, Cost__c, Vendor_Name__c =:std.getId() order by Name asc limit 400];
// dynamically create set of unique Line Items from query
Set<String> taskSet = new Set<String>();
for (BMCServiceDesk__Task__c t : tasks)
taskSet.add(t.Subject__c);
// convert the set into a string array
records = new String[taskSet.size()];
Integer i = 0;
for (String record : taskSet) {
records[i] = record;
i++;
}
}
public PageReference save()
{
// first save the incident
std.save();
// then save the procurement tasks
update tasks;
// set current page as reference to be returned to after save commits
PageReference result=ApexPages.currentPage();
result.setRedirect(true);
return result;
}
}
Debug Logs:
42.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,NONE;DB,NONE;NBA,NONE;SYSTEM,NONE;VALIDATION,NONE;VISUALFORCE,INFO;WAVE,NONE;WORKFLOW,NONE
13:45:52.0 (479332)|EXECUTION_STARTED
13:45:52.0 (483847)|CODE_UNIT_STARTED|[EXTERNAL]|06641000008T5Co|VF: /apex/Procurement_Record_Management
13:45:52.0 (1214905)|VF_DESERIALIZE_VIEWSTATE_BEGIN|06641000008T5Co
13:45:52.0 (18949081)|VF_DESERIALIZE_VIEWSTATE_END
13:45:52.383 (383505615)|CUMULATIVE_LIMIT_USAGE
13:45:52.383 (383505615)|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 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:52.383 (383505615)|LIMIT_USAGE_FOR_NS|BMCServiceDesk|
Number of SOQL queries: 7 out of 100
Number of query rows: 86 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 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:52.383 (383505615)|CUMULATIVE_LIMIT_USAGE_END
13:45:52.0 (402654770)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Incident:a1T0x000000Su1M
13:45:52.0 (403213788)|CODE_UNIT_FINISHED|Validation:Incident:a1T0x000000Su1M
13:45:52.806 (806704219)|CUMULATIVE_LIMIT_USAGE
13:45:52.806 (806704219)|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: 311 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:52.806 (806704219)|LIMIT_USAGE_FOR_NS|BMCServiceDesk|
Number of SOQL queries: 18 out of 100
Number of query rows: 95 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 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:52.806 (806704219)|CUMULATIVE_LIMIT_USAGE_END
13:45:52.0 (808787766)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:01I41000001Gv3t
13:45:52.0 (919230184)|CODE_UNIT_FINISHED|Workflow:01I41000001Gv3t
13:45:53.158 (1158033959)|CUMULATIVE_LIMIT_USAGE
13:45:53.158 (1158033959)|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: 2 out of 150
Number of DML rows: 7 out of 10000
Maximum CPU time: 458 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:53.158 (1158033959)|LIMIT_USAGE_FOR_NS|BMCServiceDesk|
Number of SOQL queries: 25 out of 100
Number of query rows: 120 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 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:53.158 (1158033959)|CUMULATIVE_LIMIT_USAGE_END
13:45:53.163 (1163138096)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Task:a2F0x0000001gT1
13:45:53.163 (1163605145)|CODE_UNIT_FINISHED|Validation:Task:a2F0x0000001gT1
13:45:53.163 (1163630288)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Task:a2F0x0000001gT2
13:45:53.163 (1163967650)|CODE_UNIT_FINISHED|Validation:Task:a2F0x0000001gT2
13:45:53.163 (1163987669)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Task:a2F0x0000001gT3
13:45:53.163 (1164314460)|CODE_UNIT_FINISHED|Validation:Task:a2F0x0000001gT3
13:45:53.163 (1164333991)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Task:a2F0x0000001gT4
13:45:53.163 (1164680182)|CODE_UNIT_FINISHED|Validation:Task:a2F0x0000001gT4
13:45:53.163 (1164701741)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Task:a2F0x0000001gT5
13:45:53.163 (1165027883)|CODE_UNIT_FINISHED|Validation:Task:a2F0x0000001gT5
13:45:53.163 (1165047344)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:Task:a2F0x0000001gT6
13:45:53.163 (1165373172)|CODE_UNIT_FINISHED|Validation:Task:a2F0x0000001gT6
13:45:53.412 (1412600170)|CUMULATIVE_LIMIT_USAGE
13:45:53.412 (1412600170)|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: 2 out of 150
Number of DML rows: 7 out of 10000
Maximum CPU time: 579 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:53.412 (1412600170)|LIMIT_USAGE_FOR_NS|BMCServiceDesk|
Number of SOQL queries: 33 out of 100
Number of query rows: 140 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 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:53.412 (1412600170)|CUMULATIVE_LIMIT_USAGE_END
13:45:53.163 (1414686811)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:01I41000001Gv43
13:45:53.163 (1478221369)|CODE_UNIT_FINISHED|Workflow:01I41000001Gv43
13:45:53.500 (1500337356)|CUMULATIVE_LIMIT_USAGE
13:45:53.500 (1500337356)|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: 2 out of 150
Number of DML rows: 7 out of 10000
Maximum CPU time: 579 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:53.500 (1500337356)|LIMIT_USAGE_FOR_NS|BMCServiceDesk|
Number of SOQL queries: 33 out of 100
Number of query rows: 140 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 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10
13:45:53.500 (1500337356)|CUMULATIVE_LIMIT_USAGE_END
13:45:53.163 (1500387202)|CODE_UNIT_FINISHED|VF: /apex/Procurement_Record_Management
13:45:53.163 (1501359275)|EXECUTION_FINISHED