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
Joe_IpsenJoe_Ipsen 

Lookup Relationship question

We have a lookup field on the Case object that references an Opportunity. As part of our workflow, the Support Rep populates this Opportunity field when they create the case. 

We would like the opposite end of this relationship to display the Case number and subject on the Opportunity. 

I currently have the Cases Related List displayed on the Opportunity object, but we see other Cases that are not related through a Lookup field in this list so I am wondering if this Related List is showing other relationships? 

 



Some other questions I have from other attempts I have tried to represent this information on the Opportunity: 

1) I tried adding a text formula on the Opportunity that would show the Case Number and/or Subject. I did not see these choices on the Choose Field window, so I am guessing these are not available. Even if they were, this would not be ideal as they would be straight text and could not be clicked to take the user to the Case object. 

2) I tried to add a lookup field on the Opportunity that points towards the Case hoping that the relationship created by the Lookup field on the case would populate this field. It did not link the case.

Best Answer chosen by Admin (Salesforce Developers) 
Joe_IpsenJoe_Ipsen
I posed this question to SFDC Support and it would seem that the Related List is a default Related List established because of the standard relationship between the Account and the Opportunity (I should have known that one).

Outside of the Related List, the only way to represent this data as fields on the opportunity would require some custom coding.  
 
Here's their response:

"The reason that you are seeing cases that are not related to the actual opportunity on the related list, is because there is standard functionality that will allow you to see the cases related to the account that the Opportunity is related to.  If you looked at the page layout and then the related lists, you will see that you have the choice between 2 cases related lists.  That is because one is standard and the other is a result of the look up field that you created on the Case page.  If you want only the related list that shows the related cases, switch that.  However your case went on to ask about how to get the case on the Opportunity.  You would want to create the lookup field on the Opportunity object again, and then create custom code to update that field when a user creates a case and populates it with that opportunity.  Please let me know if this answers your inquiry."