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
krish4ukrish4u 

Parent & child relationship on opportunity

Hi Friends,

We have a requirement like we need to group the opportunities under one opportunity(parent opportunity) and generate the invoice/Billing. 
Creating a lookup relationship under the opportunity itself, it seems to be effecting the forecasting because the parent opportunity also getting added to the user's forecast list. 
what is the best practice to follow and how can we accomplish this requirement. Any suggestions...

Thanks in advance!!!

Thanks,
Krish
 
NagendraNagendra (Salesforce Developers) 
Hi Krish,

Sorry. It's not available out of the box. Also... keep in mind that using a Lookup that looks up to the same Object will not get you things like Roll-up Summaries. (i.e. show all the values of a specific field, from all children Records, summed in a field on the parent Record.)

As Adam Marks put it... "Account level hierarchy is a self-look up with some back-end functionality that makes it all play nice. Out of the box, you can't replicate this to any other object."

Without coding, I think your best bet may be to go the path of creating a Custom Object that's associated with your Opportunities.

This is explained in this Knowledge Article.

How to Create an Opportunity Hierarchy, Parent Opportunity or Opportunity Bundles:


Salesforce does not have standard functionality that simulates an Opportunity Hierarchy. However, depending on your business needs, you may be able to simulate an Opportunity hierarchy by creating a custom object (Parent Opportunity or Opportunity Bundle) to associate other opportunities with via a Lookup Relationship.

The following scenario uses a custom object called "Parent Opportunity" and a Lookup Relationship field on the standard Opportunities object to associate standard Opportunity records with the custom Parent Opportunity record. This is a One to Many relationships between a Parent Opportunity and  Opportunities. The Parent Opportunity is simply used to group the Opportunities and reporting is facilitated using the Report object to create a custom report to fit your business needs.

This method of creating an Opportunity Hierarchy is not very flexible however using a Summary Report, the report is able to sum the Opportunity Amount values and average the Probability values and show the sum and average on the same line as the Parent Opportunity Name, thus rolling up the values from all Opportunity records and associating them with the proper Parent Opportunity line on the report. This is only useful for a visual representation of data, if the Parent Opportunity records require that values from the Opportunity records roll up for display on the Parent Opportunity record, this is not possible without additional APEX or S-control coding. Please closely evaluate your business needs before you commit to using this method to create your Opportunity Hierarchy.

Follow the instructions below to replicate this behavior.

STEP 1: Create a new custom object named "Parent Opportunity". SETUP | App Setup | Create |Objects | Click the "New Custom Object" button.
  • If you plan to name each Parent Opportunity record, choose Data Type "Text" when creating the new custom object.
  • Make sure the object is reportable by checking the Allow Reports or Enable Reports checkbox.
  • Decide if this object should have its own Notes and Attachments related list and make the appropriate selection in the checkbox titled "Add Notes and Attachments related list to default page layout".
  • Decide if this object should have its own tab. If it should have its own tab, make a selection in the checkbox titled "Launch New Custom Tab Wizard after saving this custom object".
STEP 2: Create a new custom Lookup Relationship field on the Opportunities object. SETUP | App Setup | Customize | Opportunities | Fields | Click the "New" button in the section titled "Opportunity Custom Fields & Relationships".
  • The lookup relationship field should be Related to The custom object you created in Step 1 (Parent Opportunities).
  • Add the lookup relationship field to the Opportunities Page Layout.
STEP 3: Create a new Custom Report by going to the Reports tab and clicking the "Create New Custom Report Button".
 
Given that, in Step 1 you enabled reporting for the new custom object, and you created a lookup relationship field on the Opportunities object, you should have a new report type available to you in the Report Wizard.
  • Report Wizard Step 1: Select Opportunities as the data type you wish to report on.Look for Opportunities and Parent Opportunity (or Name of Custom object created in Step 1) as an option in the report type list.Select Summary Report for the report format.
  • Report Wizard Step 2: Check the Sum checkbox for the Amount column and the Average checkbox for the Probability check-box. This will associate the total Amount value and the average probability value of all Opportunities with the related Parent Opportunity.
  • Report Wizard Step 3: Summarize the information by Parent Opportunity Name.
  • Report Wizard Step 4: Select the data fields that you wish to display for your report. Typical fields you might want to check to display are:
 
Opportunity Information - Opportunity Owner, Opportunity Name, Close Date, Stage, Amount, and Probability (%).  
Account: General - Account Name
Parent Opportunity - General: Parent Opportunity: Name
  • Report Wizard Step 5: Order the Selected Columns as desired.
  • Report Wizard Step 6: Enter any additional criteria. If you wish the report to display only the Parent Opportunity data you can check the Hide Report Details checkbox and the individual opportunity report results will be hidden but the Parent Opportunity summary report lines will display the Average Probability and Total Amount of all opportunities associated with the Parent Opportunity.
  • Save the report with the name "Opportunity Hierarchy Report". Save the report to a folder where you can easily find it so that it can be accessed and run later.
 
STEP 4: Create a Parent Opportunity record and save it. Create several Opportunities and select the name of the proper Parent Opportunity record on the Parent Opportunity lookup field. Run the report that you saved in the previous step to test it out.

FINAL STEP: Add additional customization such as APEX code and Workflow triggers to meet additional business needs. Some things you may want to consider for further customization:

Create validations for the Parent Opportunity object so that its record cannot be closed until all the Opportunities related via lookup have also been closed won/lost.

Adding your Opportunity Hierarchy Report to dashboards.

Hope this helps.

Best Regards,
Nagendra.P

 
Rajani Polampalli 4Rajani Polampalli 4
@Nagendra,

Would you please help me out on the below similar requirement?

We have a requirement where user must have entered Account in the Account Name lookup field and the lookup up for Contact should show all Contact names associated with the selected Account Name. And also, In lookup it should show only the Contact records of Account when the Contact Record Matches below criteria:
  "Roll up Status = Primary"

Where Roll up Status is a custom field. 

It has to be done using Salesforce out of functionality since client is not recommened for using customization.