New answers tagged

2

This is more a suggestion of what to check than an answer but is a bit long for a comment. Referring to List of setup objects in Salesforce, Territory2 is a setup object so the error message would suggest that you are updating Territory2 before you update ZTS_EU_Territory__c. I assume getStdTerritoryRecordList does not update Territory2? Also check that ...


0

You have some assumptions here that you can work around. The problem is, I can't use DML because it's firing from a Trigger, I can't return this field since it's a @future method and must be void and I also can't access to Trigger.new or Trigger.newMap (they are null on the future method) The future method can in fact perform DML. The future method is ...


2

Yes. Every insert DML operation that you successfully perform populates the Id field of the inserted sObject.


3

The error itself is pretty straightforward. If your record has an Id already, then it cannot be inserted. Inserting a record is what gives it an Id in the first place. So trying to insert a record that already has an Id is not a valid operation. Test.loadData() itself doesn't cause records to be inserted, so that means the static resource you're passing into ...


0

You would need to assign the value to the relationship object, not the Id/lookup object. This is __r rather than __c: newleadAcc.Lead__r = newlead;


1

Your trigger is not at fault here. In fact, at a quick read, it appears that your trigger is correctly and effectively bulkified. However, you note in a comment that there are quite a few other automations on both [Contact and Campaign Member]. This suggests that the fault lies not with this trigger per se but with the totality of automation on either or ...


Top 50 recent answers are included