You need to sign in to do that
Don't have an account?
Sam D.
Event SOQL query empty (in trigger only) when its a SHARED ACTIVITY
Strange problem here. I have a trigger that does a simple SOQL query to retrieve an Event by its ID, e.g.:
It usually works with no problems. However when multiple contacts are added to the event and it becomes a shared activity, suddenly the query comes up empty when run in the trigger, even under a sysadmin profile. Yet the same exact query is successful when run in SoqlXplorer, and when the code is executed using anonymous apex.
Any ideas for what might be going on? Does changing the Event to a shared activity with multiple contacts somehow change its ability to be queried via its ID?
Thanks.
List<sObject> theRecords = [select Id from Event where id = '00UC000000Pyy6c'];
Any ideas for what might be going on? Does changing the Event to a shared activity with multiple contacts somehow change its ability to be queried via its ID?
Thanks.
Where is the query being run? In Apex code?
If so, you need to check the API version of code unit (class or trigger) that is running the query. Shared Activities are quite new, and they're invisible to older versions of the API. So adding multiple contacts to an Event can make it disappear from the code's view.
The earliest version of the API that can see shared activities is 26. So you need to make sure your code is API 26 or later.
You can view and change the API version of classes and triggers in the Salesforce UI. If you're using eclipse you can edit the metadata XML directly.
Dominic
All Answers
Where is the query being run? In Apex code?
If so, you need to check the API version of code unit (class or trigger) that is running the query. Shared Activities are quite new, and they're invisible to older versions of the API. So adding multiple contacts to an Event can make it disappear from the code's view.
The earliest version of the API that can see shared activities is 26. So you need to make sure your code is API 26 or later.
You can view and change the API version of classes and triggers in the Salesforce UI. If you're using eclipse you can edit the metadata XML directly.
Dominic
Btw just curious, when you upgrade the API, do you usually upgrade to the most recent version, or the minimum version that solves your issue (in this case 26)?
...probably...