1

There are three objects:

  1. Room: Field - Price(Currency)
  2. Customer: Field - Total Amount(Rollup-(Amount))
  3. Booking: Field- Amount (Formula-currency).

-> Booking has master-detail relationship with Customer and Look-up relationship with Room.

Now I need Price to calculate the 'Amount' so that requires merge field i.e Room_No.__r.Price__c But on using this I'm facing an error: "Unable to use this formula containing derived values because the field is included in the following roll-up summary field(s): Customer.Total Amount. To continue, remove references to derived values such as current date, current user, or user-role. (Related field: Formula)"

Since we can't use merge field in roll-up summary field formula, so I created an extra field in booking which references to amount and tried to roll-up that field but still couldn't due to the same issue.

So is there any other way to implement this logic and calculate the amount using price without having to remove roll-up field(Total Amount)? Please provide steps if possible.

1 Answer 1

0

You're not allowed to do this, because then the rollup field would have to be able to detect changes on a separate record in a cascading fashion, potentially updating many thousands or millions of records. To make this work, you'll have to determine the correct behavior you want for your configuration. If the Room's Price changes, should the Booking Room Price change? Make sure you know how you want to handle this situation.

To get started, though, we first need to make a Booking field called "Room Price" (Room_Price__c). Next, make a Before-Save Record Flow that copies Room_No__r.Price__c to the new Room_Price__c field. Finally, adjust the Amount formula to use this new field. You'll need to touch all existing records to load the initial value. You'll be able to create your rollup summary field at this point.

Now, from here, you need to decide on if the Room's Price changes, does the Booking price also change. If so, use the Process Builder to trigger on Price changes, and update all child records with the new Price.

Based on the previous paragraph, if you do not want the Booking's Room Price to change when the Booking is edited, you'll also need to adjust the Before-Save Record Flow such that it ignores the Booking if the Room Price is already set. This also allows a user to manually override the Room Price if it is incorrect or otherwise needs to be adjusted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .