New answers tagged

3

The trigger will only contain the field values of the records, not the fields of the referenced records. So in order to get the name of the creator, you will have to query it separately, for example: List<Task> tasksWithCreatorNames = [SELECT Id, CreatedBy.Name FROM Task WHERE Id IN :Trigger.new];


0

Solved. This error was being caused by the approval process setting a value on Rejection that was invalid for this scenario. This value activated a Process which in turn activated a validation rule. The weird thing is that the error message "INVALID_CROSS_REFERENCE_KEY" provided zero help in discovering this issue, and led me on a search in a totally wrong ...


1

You cannot access second level fields through the trigger.new list. You need to query all 2nd level fields you need —e.g. cm.Lead.Primary_Campaign__c— and iterate through that query results instead. There's also a problem with how you are adding the leads to be modified to your lists, you need to add the entire records you modified and not just the ids. ...


2

Even if a field is indexed a filter might still not be selective when: The filter value includes null (for instance binding with a list that contains null) From your debug logs, you're running this query: SELECT Id, OwnerId, LastName, AccountId, Email FROM Contact WHERE (Email = :tmpVar1 OR Personal_Email__c = :tmpVar2) LIMIT 1 Since these ...


0

From Salesforce's documentation found here: You may find that the query in question needs to be more selective in the WHERE clause. According to the Salesforce standards & best practices - the where clause needs to subset 10% or less of the data. Consider putting more filters on your WHERE clause(s) to reduce the number of records you're ...


Top 50 recent answers are included