Get Related Field Values

Posted by neetuagw on 24-Oct-2014 04:35

I have made many to many relationship  between two objects.Now I want to grab the list of all the fields belong to particular object record.

I have used rbv_api.getRelatedFields() and I get only the Ids of these fields.

How to get the particular value like first name?? 

Posted by Gian Torralba on 24-Oct-2014 10:12
Hello, Unfortunately, there is no way to achieve this using a single step unless you are using the LOOP token inside the formula body in a trigger which is not recommended. You need to use rbv_api.getRelatedIds() to loop thru each record's ID and then do a rbv_api.selectQuery() to get the fields of that record. There are also two ways to achieve this. You can use the IN condition inside the rbv_api.selectQuery to avoid the loop on each ID or use a javascript loop if you aren't expecting the records to increase drastically. Thank you, Gian

All Replies

Posted by Gian Torralba on 24-Oct-2014 10:12
Hello, Unfortunately, there is no way to achieve this using a single step unless you are using the LOOP token inside the formula body in a trigger which is not recommended. You need to use rbv_api.getRelatedIds() to loop thru each record's ID and then do a rbv_api.selectQuery() to get the fields of that record. There are also two ways to achieve this. You can use the IN condition inside the rbv_api.selectQuery to avoid the loop on each ID or use a javascript loop if you aren't expecting the records to increase drastically. Thank you, Gian
This thread is closed