function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akash Diwan.ax1657Akash Diwan.ax1657 

Accessing values from related list

Hi,

 

i have one custom object names FollowUp & one Standard object Contact. I have defined m:m relationship between then using Junction object named Jobj. Noe a related list for that Jobj comes in both contact & Followup object records. I want to access the value present in the related list on records of  the followup object.

 

I tried it this way but it gives an error:

 

Didn't understand relationship 'Jobjs__r' in field path. 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.

 

The code is as follows:

 

[select id,Name,Comment__c,tre__c,Send_Email__c,IsComplete__c, (SELECT Name,Jobjs__r.First_Name__c FROM FollowUp__c.Jobjs__r) from FollowUp__c WHERE OwnerId = : USERINFO.GETUSERID()]).

 

How to do it?

 

 

Shiv ShankarShiv Shankar

Do this way

 

[select id,Name,Comment__c,tre__c,Send_Email__c,IsComplete__c, (SELECT Name,Jobjs__r.First_Name__c FROM Jobjs__r) from FollowUp__c WHERE OwnerId = : USERINFO.GETUSERID()]).

Vinit_KumarVinit_Kumar

Akash,

 

Please try below :-

 

[select id,Name,Comment__c,tre__c,Send_Email__c,IsComplete__c, (SELECT Name,First_Name__c FROM Jobjs__r) from FollowUp__c WHERE OwnerId = : USERINFO.GETUSERID()]);

 

//Assuming Jobjs__r is the relationship name between FollowUp__c and Jobjs__c