Solved

Relationship to sibling object

  • 28 April 2017
  • 4 replies
  • 41 views

I have an object (shipping addresses) that is child in Master/Detail to Opportunity.  

The Opportunity Line Item looks up to the Shipping Address (line items may get shipped to different locations).

 

I can't seem to build the relationship in Drawloop correctly to get to the Shipping Address.  Seems I should be able to start with Opportunity Line Item and then get to Shipping Address - but my only option to start with is Opportunity.  

 

What am I doing wrong?

icon

Best answer by ryan_oleary 28 April 2017, 17:37

View original

4 replies

Userlevel 4
Badge +8

Hey Mary Stevens‌,

If you want to do replication through a lookup you'll need to use SOQL. 

Example:

Opportunity(Starting Object)               Shipping Address (Lookup from Opp Line Items)

                                 Opp Line Items (Child)   

I hope that helps!

Cheers,

Ryan

Thank you Ryan - I kinda wondered if that was what I needed to do.  

I'm not super strong in SOQL queries - Will my query be structured something similar to this? (I know I'll need to use the correct field names and __r relationships.)

Select NameOfOppLineItemShippingField from Opportunity.ShippingAddress where OppLineItem.OppID = Opportunity.ShippingAddress.OppID?  

And then are you saying this will show up in my field tagger as a relationship?

Userlevel 4
Badge +8

Hey Mary,

You want something like this and again you'll need to replace these with the proper API names.

SELECT Id, ShippingAddress__r.Name FROM OpportunityLineItem WHERE Opportunity = '<<Opportunity_Id>>'

Cheers,

Ryan

Hi Ryan - 

This took me several hours to get exactly what I needed - mostly due to me not really 'reading' what you were suggesting.  I worked on it for quite a while before it dawned on me that the WHERE is comparing to a tag.  (duh!)

Also, I already had a custom Opportunity Line Item relationship in there, so after lots of testing (and swearing), I realized I had to put ALL needed fields in this query, swap out the start row tag for this new relationship in order for the row replication to pull everything that I needed.  

At any rate, I learned a ton today (I feel a bit smarter) and I very much appreciate your help!  :-)

Reply