Timeline for Change custom lookup on object through trigger
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 9, 2014 at 18:01 | comment | added | Keith C | The issue is more that within a single transaction you can only do limited work as described here salesforce.com/us/developer/docs/apexcode/Content/…. So if more than 100 Customer__c objects are inserted in one go (e.g. when a backup is restored or data is moved from one org to another) you will exceed the "Total number of SOQL queries issued" limit of 100. Or if there are more than 10,000 Customer__c objects, you will exceed the "Total number of records retrieved" limit of 10,000. So your code needs to be crafted to avoid those problems. | |
Sep 9, 2014 at 17:53 | comment | added | De Heer Jør van Oerle | Thank you for your help :) it is working now. I understand what you mean: I can do only a single query every so many seconds/ minutes, so better to use a list and then perform a list query I guess? | |
Sep 9, 2014 at 16:55 | comment | added | Keith C |
For the dbc case you should be able to have ..., Title__c , Account__r.Priority__c from Customer__c in the query. But do reconsider the overall algorithm too as mentioned in my first comment.
|
|
Sep 9, 2014 at 16:41 | comment | added | De Heer Jør van Oerle | How do I do that? If I query Account__c, I get the same error I would if I didn't query account at all and I can't query account__r, I get the error: No such column 'Account__r' on entity 'Customer__c'. | |
Sep 9, 2014 at 16:36 | comment | added | Keith C | If you must reference the Account priority, you will have to also query that for the Trigger.new values using the Contact.AccountId value. You can include that in the dbc query using a relationship query. | |
Sep 9, 2014 at 16:34 | comment | added | Keith C | As well as the problem with the account reference, your trigger will also hit governor limits when Customer__c is updated in bulk because you are doing a query per Customer__c. See e.g. the answer to lead convert to avoid duplicate values to contact for techniques to avoid that. | |
Sep 9, 2014 at 16:12 | review | First posts | |||
Sep 9, 2014 at 16:16 | |||||
Sep 9, 2014 at 16:11 | history | asked | De Heer Jør van Oerle | CC BY-SA 3.0 |