New answers tagged

0

you should not put the values into map directly first check if map has key or not (if true) then add the values to that key You should add ParentIdSet.add(e.Employer__c.Id);** in palce of ParentIdSet.add(e.Employer__c); for(Employer__c eobj : elist){ if( parentMapObj.Containskey(eobj.Id)) { parentMapobj.get(eobj.Id).add(eobj); }...


0

This is a simple case of allowing for not having a parent ID in the map. In the first iteration you only get employers (parents) for employees with a phone number change, but in the last loop you assume you can find the employer (parent) for all employees. Update the latter loop like: for(Employee__c emobj : trigger.new){ Employer__c employer = ...


3

Since you didn't specify an access modifier for the inner class, the default one (private) has been used, as stated in the documentation: The private access modifier declares that this class is only known locally, that is, only by this section of code. This is the default access for inner classes—that is, if you don't specify an access modifier for an inner ...


0

You use a field mapping technique, then you can use Dynamic Apex methods to get the values dynamically. Here's a simplified version: public with sharing class BankerCheck { static Map<String, String> fieldMap = new Map<String, String> { 'BankerHome__c' => 'Home', 'BankerWork__c' => 'Work', 'BankerCell__c' => '...


1

Relationship fields are not automatically populated in a trigger context. This means that: if(SE.Activity__r.Id != null) Will always be false. You need to check the lookup field directly: if(SE.Activity__c != null) Note that your code will also fail in some situations if too many records share one parent. You should use an AggregateResult query to avoid ...


Top 50 recent answers are included