0

I need to an object and modify it's parent if condition are fullfiled but i'm encoutering an wierd behavior: in my SOQL the __r.field doesn't retrieve the fields values:

Below my anonymous code:

list<FLU_PaymentDeadline__c> pdl = [Select FLU_Contract__r.Name, 
FLU_Contract__r.FLU_ReviewAutoPay__c, SystemModstamp, FLU_PaymentMeans__c
                                    FROM FLU_PaymentDeadline__c 
                                    where FLU_PaymentMeans__c = 'CB'];
system.debug(pdl);

My debug is the following enter image description here

I can see the contract even if I did not query it and cannot see any field on the contract.

I tried with the query editor the same query:

enter image description here

Here i got what i want.

Can anybody else encoutered this kind of behavior already? I did check my profiles right in case it had something to do with it but I got access on all fields required.

  • What if you do system.debug(pdl. FLU_Contract__r); ? It could be just a debug that does not show relationship, but they are actually queried – kurunve Jul 28 at 9:28
  • @kurunve it says :"Variable does not exist: FLU_Contract__r" I tryed aswel debugging just the field (FLU_Contract__r.FLU_ReviewAutoPay__c) same error. – Julien Souchi Jul 28 at 12:01
  • There is a typo on my snippet, it should be without space in between -- system.debug(pdl.FLU_Contract__r); – kurunve Jul 28 at 12:07
  • Yeah i saw but still not working – Julien Souchi Jul 28 at 12:14
  • @kurunve you were right in your first answer: "It could be just a debug that does not show relationship, but they are actually queried" I answered my question below you can check it. Thanks – Julien Souchi Jul 28 at 12:24
1

Ok i got the answer, and it's a stupid one...

It appears that as I query a list, if I debug it I don't have the debug information of the parent. I have to debug element by element to see the parent relationship.

list<FLU_PaymentDeadline__c> pdl = [Select FLU_Contract__r.Name, 
FLU_Contract__r.FLU_ReviewAutoPay__c, SystemModstamp, FLU_PaymentMeans__c
                                    FROM FLU_PaymentDeadline__c 
                                    where FLU_PaymentMeans__c = 'CB'];
system.debug(pdl[0]);

Will show the parents fields.

| improve this answer | |
0

If Profile level FLS and CRUD accesses are given, you should check the sharing settings of the contract object.

| improve this answer | |
  • Did that aswell, sharing settings are Public Read/Write – Julien Souchi Jul 28 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.