You need to sign in to do that
Don't have an account?
sfadm sfadm
Custom Object how to get actual query data?
I have two related custom objects. I'll name them:
"Custom_Object1__c"
and
"Custom_Object2__c".
In the "Custom_Object2__c" I have a lookup field to "Custom_Object1__c". In "Custom_Object1__c" I have a related list with "Custom_Object2__c".
In "Custom_Object2__c" I also have a checkbox field. When changing the state of the checkbox I need in the "Custom_Object2__c" trigger to get all checked "Custom_Object2__c" records of "Custom_Object1__c".
I've implemented a code in the trigger and I'm trying to get all checked "Custom_Object2__c" records via the following query:[SELECT checkbox__c, Custom_Object2_Status__c, Id FROM Custom_Object1__c where id =:Custom_Object1_ID__c]
The issue I have is that the query returns old data which is before the update of the record.
For instance I have four out of 4 checked Custom_Object2__c records but in the trigger the query returns 3 instead of 4 checked.
How can I get the actual data?
"Custom_Object1__c"
and
"Custom_Object2__c".
In the "Custom_Object2__c" I have a lookup field to "Custom_Object1__c". In "Custom_Object1__c" I have a related list with "Custom_Object2__c".
In "Custom_Object2__c" I also have a checkbox field. When changing the state of the checkbox I need in the "Custom_Object2__c" trigger to get all checked "Custom_Object2__c" records of "Custom_Object1__c".
I've implemented a code in the trigger and I'm trying to get all checked "Custom_Object2__c" records via the following query:[SELECT checkbox__c, Custom_Object2_Status__c, Id FROM Custom_Object1__c where id =:Custom_Object1_ID__c]
The issue I have is that the query returns old data which is before the update of the record.
For instance I have four out of 4 checked Custom_Object2__c records but in the trigger the query returns 3 instead of 4 checked.
How can I get the actual data?
what is your trigger context, please make sure it after update if you want the updated data not the previous one. There is few other possibilites of the issue your are facing through. you can past the code here.
Thanks