We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

1

You should check in the second for loop that if Comment__c of custom object OppDesc__c is actually null or blank or have value . If Comment__c is null then actually there is nothing to update. Add a debug log in second for loop : for(OppDesc__c od : newOppDesc){ //checking Comment__c is actually null or blank or have value System.debug('comment: @...


3

Agreeing with David, you need to add WHERE clause to your query and also the names of your variables should be meaningful. Like you mentioned, I think you are missing multiple tool records for the same opportunity. Map<Id, List<Tool__c>> mapToConnect = new Map<Id, List<Tool__c>>(); List<Tool__c> tools = new List<Tool__c>(...


2

List<Tool__c> toUpdate = [SELECT Id, Comment__c, Mopp__r.Opportunity__c FROM Tool__c]; Running an unbounded query like this (no WHERE clause) is risky with regard to several limits, as well as general performance. You should update only those records whose state needs to change based on the trigger event. Your logic here is likely to be the culprit: ...


1

The put method of maps update an item when it finds the item: From the documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_map.htm "If the map previously contained a mapping for this key, the old value is returned by the method and then replaced." Here you have an example: Note: myList is String and ...


Top 50 recent answers are included