Cannot retrieve converted relationship records

Posted by matman on 08-Jan-2015 07:17

I have four objects: Realtor, Subscription, Subscription Article and Article. Subscription Article is a converted relationship between Subscription and Article.

When I want to retrieve all Realtors related to Subscription I use the following: {!R116103884}. This successfully returns me all related Realtor records.

When I want to retrieve all Subscription Articles I use: {!R116227802}. However, this returns me 0 Subscription Articles for every Subscription I try it on, even though they have multiple related Subscription Article records.

The same counts for rbv_api.getFieldValue(); . Also, when I use the "Template Helper" and click on the second dropdown, I can select Realtor, but not Subscription Article. But when I click on the first dropdown, I can select "Related Realtor" and I can select "Related Subscription Article".

Anyone can confirm? Is there any fix? This is a big problem, because now I can't synchronize LDF for the "Subscription Articles".

All Replies

Posted by Gian Torralba on 08-Jan-2015 08:38

Hello,

What do you mean by a converted relationship. Maybe there is a problem with the record's relationship. Can you go to the view page of the subscription and display the related list view for the subscription articles so that we can confirm that the relationship between this records are correct.

Thank you,

Gian

Posted by matman on 08-Jan-2015 08:47

Hi Gian, when I created my relationship between Subscription and Article I went to my object configuration page. In the relationships section on this page I clicked on "convert" which provided me with a new Relationship page I used to create a new intermediate object.

This is a shot of the view page, as you can see the related view works like it should work:

Posted by Gian Torralba on 08-Jan-2015 09:22

Hello,

Can you verify that you are using the correct token since that new one is the intermediate object. You can also try using the getRelatedID method if it will return any records.

Thank you,

Gian

Posted by matman on 08-Jan-2015 09:40

Hi Gian, the token works, but I've just discovered that it works differently than normal. I usually retrieve my records the following ways:

Method 1: retrieve all records (Does not work now)

var records = [{!R116227802}];
return "" + records[0]; // returns undefined

Method 2: retrieve the first record (Does not work now)

var record = [{!R116227802#id}];
return "" + record; // returns 0

Method 3: retrieves only the first record (Does work)

var records = [{!R116227802.id}];
return "" + records[0]; // returns 117689050

So I will just edit my code so it supports rbv_api.getRelatedIds().

Do you have any clue why the first two methods don't work in this case?

Posted by Gian Torralba on 08-Jan-2015 10:00

Hello,

Method 2 will not work since you have a 1 to many relationship and I believe that the use of that token is for single record purpose only. We usually use the getRelatedIds to loop thru related record so I need to test method 1 first.

Thank you,

Gian

Posted by matman on 08-Jan-2015 10:03

Hey Gian, it actually does work for my other one-to-many relatinships. It only retrieves the first ID. But it's designed to work with a lookup field, which I don't have. (Read that in the documentation.)

Posted by pvorobie on 08-Jan-2015 10:48

Please check these formulas in Formula Debugger, you'll see how these template tokens are resolved before JavaScript execution.

Posted by matman on 09-Jan-2015 02:19

I've tested, but it's not exactly a problem I anticipated, you see, method 1 works perfectly fine with my 16 other scripts. It's just this single situation where it doesn't work. I didn't know these ways of fetching data are dependent of a lookup field.

Anyway, it's fixed now, thanks a lot!

This thread is closed