1

I am trying to query some fields using inner query where ChargentOrders__Transaction__c is my managed package and Agreement__c is the parent and ChargentOrders__Transaction__c is child.But i am getting error: ^

ERROR at Row:1:Column:69 Didn't understand relationship 'ChargentOrders__Transactions__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

[select Payment_Options__c,(select id,ChargentOrders__Amount__c from ChargentOrders__Transactions__r) from Agreement__c]

2 Answers 2

2

You're not referring to proper Child Relationship name. Go to your object - select your field and locate Child Relationship name for that field. Use that name. Refer below snapshots for example:

Step 1:

enter image description here

Step 2:

enter image description here

0
1

Your relationship on Agreement to the ChargentOrders__Transaction__c will NOT contain a namespace since it is local to your org.

Most likely it is just Transactions__r but only you will know since you created the field. Look at the child relationship name on the lookup definition on the Agreement object

If you have trouble getting the right relationship name use this code from Adrian Larson:

for (ChildRelationship relationship : SObjectType.Agreement__c.getChildRelationships())
    if (relationship.getChildSObject() == ChargentOrders__Transaction__c.sObjectType)
        system.debug(relationship.getRelationshipName());

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .