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
pradsy90pradsy90 

Joining Accounts --> Contact -> Reservations data together --- Accounts Tab

Hi -

 

I have a requirement to display the number of open reservations an account has in the Accounts tab. To get the number I will need to join the Accounts Contacts and Reservations and then get the number of records. Basically Accounts -> Contacts -> Reservations (Open status)

 

1. Can I place a custom field as a formulae and do this?

 

2. Some discussion boards talk about a roll up field but that seems to be limited only to Accounts -> Contacts

 

Any suggestion on the best way to get this done is welcome.

 

Thanks is advance for your time.

 

Regards,

Pradhip. S

 

 

Best Answer chosen by Admin (Salesforce Developers) 
AuyonAuyon

Pradhip,

There are several options in front of you, it would depend on how you would like to implement it.

 

Unfortunately, formulae or roll-up fields might fall little short for the requirement. In a formula, you can refer to a parent but not a child, reason would a parent can have multiple child and the formula would not know which record to pick to calculate the value.

In Roll-Up fields, work between parent and child and in your case the data has to come from Reservation rather than Contact. (Although I am not sure if you can create double roll-up fields)

 

Here are some of ways for which you can try out:

 

1. You can write a trigger in reseveration  to update the account field.

2. You can create a small inline VF Page to show related Reservation Data in Account tab and add it to the Account detail page.

3.  If you become really desperate, you can create a third object which is a junction of Reservation and Account and then add that to the related list of the account.

 

Ponder. There might be few more cool ways too.

 

All Answers

AuyonAuyon

Pradhip,

There are several options in front of you, it would depend on how you would like to implement it.

 

Unfortunately, formulae or roll-up fields might fall little short for the requirement. In a formula, you can refer to a parent but not a child, reason would a parent can have multiple child and the formula would not know which record to pick to calculate the value.

In Roll-Up fields, work between parent and child and in your case the data has to come from Reservation rather than Contact. (Although I am not sure if you can create double roll-up fields)

 

Here are some of ways for which you can try out:

 

1. You can write a trigger in reseveration  to update the account field.

2. You can create a small inline VF Page to show related Reservation Data in Account tab and add it to the Account detail page.

3.  If you become really desperate, you can create a third object which is a junction of Reservation and Account and then add that to the related list of the account.

 

Ponder. There might be few more cool ways too.

 

This was selected as the best answer
sandeep@Salesforcesandeep@Salesforce

You should have a Rollup field on Account of Reservation in order to count. Here is master detail relation ship between Account ( Master) - Reservatio ( detail) so all Reservation will be coming under Account record.

Satish_SFDCSatish_SFDC
Rollup summary works if you there is a master detail relationship between the objects.
From your question, i assume that Contacts and Reservations has a lookup relationship.
In this case you would have to write a trigger to summarize and populate it on a field in Accounts.

Regards,
Satish Kumar
pradsy90pradsy90

My object relationship goes

 

Account -> Contact -> Reservations.  But, I want to see the number of reservations at an Account level. Yes, I currently have Contact -> Reservations as a look up

 

So, even if I had a Roll Up summary field on Account it still would not work since I have to go two levels deep (Contacts then Reservations).

 

Almost seems like VF page is my only option.

 

Thanks for the time though.

pradsy90pradsy90

My object relationship goes

 

Account -> Contact -> Reservations.  But, I want to see the number of reservations at an Account level.

 

So, even if I had a Roll Up summary field on Account it still would not work since I have to go two levels deep (Contacts then Reservations).

 

Almost seems like VF page is my only option.

 

Thanks for the time though.