Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents


Link to User Guides: 

P3. Opportunity Management

Change LogDateOwner
Page Created

 

Enhancement: Probability Weighted Contribution Margin: 

Jira
serverSyensqo's Jira
serverIdd8efc1ef-48bd-3b4e-8714-ad827f4f059b
keyCPROMOG-12

 

MILIC-ext, Nikola 

User Roles and Permissions

Opportunity Line Items (OLIs) inherit their visibility and access controls directly from their parent Opportunity records. To check opportunity Access please go to following page and check under User Roles and Permissions 


Opportunity Products: Field-Level Update and Validation Overview

1. GBU (SLV2_GBU__c)

  • On Create:
    • The SLV_OpportunityProductManagement.syncGBU method sets the GBU on OpportunityLineItem to match the Opportunity GBU field (SLV6_OPP_GBU__c).
  • On Update:
    • The same syncGBU method is invoked in the SLV_OpportunityProductManagement class to sync the GBU when the Opportunity or Opportunity Product’s GBU changes.

2. Contribution Margin (Contribution_Margin__c)

  • On Update:
    • The updateContributionMargin method in SLV_OpportunityProductManagement adjusts Contribution_Margin__c based on the calculation method set in SLV5_OPR_CM_Calculation_Method__c:
      • If the method is Percent, the margin is set to Contribution_Margin_Percent__c.
      • If the method is Amount, the margin is set to Contribution_Margin_Amount_per_UoM__c.

3. Opportunity Name (SLV_Product_Name__c)

  • On Create:

    • The updateOpportunityname method in SLV_OpportunityProductManagement sets the Opportunity name based on the SLV2_OLI_Application__c field if it does not match the current value in SLV_Product_Name__c.
  • On Update:

    • This same method (updateOpportunityname) updates the Opportunity name if there is a mismatch between SLV2_OLI_Application__c and SLV_Product_Name__c.
  • On Delete:

    • After deleting an Opportunity Product, the Opportunity name is updated through updateOpportunityname to reflect the change.

4. Product Forecast (SLV_Product_Forecast__c)

  • On Create:

    • When an Opportunity Product is created, SLV_updateProductForecast updates forecast records based on SLV5_OPR_Unit_of_Measure__c and SLV5_OPR_CM_Calculation_Method__c.
  • On Update:

    • The same SLV_updateProductForecast method recalculates forecast records when SLV5_OPR_Unit_of_Measure__c or SLV5_OPR_CM_Calculation_Method__c changes.
  • On Delete:

    • SLV_deleteProductForecast deletes forecast records when an Opportunity Product is removed.

5. Opportunity Involved Products (SLV_Involved_Product__c)

  • On Create:

    • updateOpportunityInvolvedProduct in SLV_OpportunityProductManagement adds Product2.Name from the OpportunityLineItem to SLV_Involved_Product__c on the Opportunity.
  • On Update:

    • This method (updateOpportunityInvolvedProduct) also triggers on updates, adjusting SLV_Involved_Product__c based on the list of related Opportunity Products.
  • On Delete:

    • When an Opportunity Product is deleted, the updateOpportunityInvolvedProduct method removes the product from the Opportunity's SLV_Involved_Product__c field.

6. Product End Use (SLV2_OPP_Product_End_Uses__c)

  • On Create:

    • In the updateOpportunityInvolvedProduct method, SLV_End_Use__c from the Opportunity Product is added to SLV2_OPP_Product_End_Uses__c on the Opportunity.
  • On Update:

    • The same method updates SLV2_OPP_Product_End_Uses__c to reflect any changes in SLV_End_Use__c for related Opportunity Products.
  • On Delete:

    • When an Opportunity Product is deleted, the updateOpportunityInvolvedProduct method removes its SLV_End_Use__c from SLV2_OPP_Product_End_Uses__c.

7. Application (SLV2_OPP_Application1__c)

  • On Create:

    • SLV_End_Use__r.SLV_Application__c values are added to SLV2_OPP_Application1__c for new Opportunity Products in updateOpportunityInvolvedProduct.
  • On Update:

    • Updates to SLV_End_Use__r.SLV_Application__c on Opportunity Products prompt recalculation of SLV2_OPP_Application1__c.
  • On Delete:

    • When an Opportunity Product is deleted, the method removes its application data from SLV2_OPP_Application1__c.

8. Yearly Revenue (SLV_Yearly_Revenue__c)

  • On Create and Update:
    • updateProductTotalAmount in SLV_OpportunityProductManagement sets SLV_Yearly_Revenue__c based on SLV_Yearly_Volume_at_Maturity__c and SLV5_OPR_Target_Unit_price_per_UoM__c.
    • If these values are null, SLV_Yearly_Revenue__c is set to zero.

9. Product History (SLV6_Opportunity_Product_History__c)

  • On Create and Update:
    • addOpportunityProductHistory creates records in SLV6_Opportunity_Product_History__c to log changes in fields listed in SLV6_Opportunity_Product_fields_Tracking FieldSet.
  • On Delete:
    • deleteOpportunityProductHistory deletes history records associated with deleted Opportunity Products.

10. Negotiation History (SLV_Negotiation_History__c)

  • On Delete:
    • The deleteNegotiationHistory method deletes negotiation history records associated with deleted Opportunity Products.

11. Dummy Product Flag (SLV_Dummy_Product_Exists__c)

  • On Create and Update:
    • updateDummyProductFlag in SLV_OpportunityProductManagement sets the SLV_Dummy_Product_Exists__c flag on the Opportunity if dummy products are linked to it.
  • On Delete:
    • This flag is also reset if dummy products are removed from the Opportunity.

12. Total Amount (SLV_Product_Total_Amount__c)

  • On Create and Update:
    • updateProductTotalAmount calculates and updates the SLV_Product_Total_Amount__c for Opportunity Products, using volume and target unit price fields.

Validation Rules for Opportunity Products

1. No Dummy Product for Qualified Opportunities

  • Error Message: "Dummy Products cannot be added to Opportunities marked as Product Qualified."
  • Condition: This rule enforces that no dummy products are associated with qualified Opportunities. It triggers when:
    • User Permissions: The user does not have permission to bypass validation rules ($Permission.Bypass_Validation_Rules = FALSE).
    • Opportunity Type: The Opportunity’s Type field (Opportunity.Type) is set to “Product Qualified.”
    • Product Name: The Product Name field on the Opportunity Line Item (OpportunityLineItem.Product2.Name) is set to “Dummy Product.”

2. Manufacturing Plant Validation

  • Error Message: "Selected Manufacturing Plant is not approved for this Opportunity."
  • Condition: Ensures only approved manufacturing plants are used in Opportunity Line Items. It activates when:
    • User Permissions: The user does not have permission to bypass validation rules ($Permission.Bypass_Validation_Rules = FALSE).
    • Manufacturing Plant Selection: The Opportunity Line Item’s Manufacturing Plant field (OpportunityLineItem.Manufacturing_Plant__c) is set to an unapproved plant (not within the allowed list for the Opportunity type).

3. Shipping Plant Validation

  • Error Message: "Selected Shipping Plant is not allowed for this Opportunity."
  • Condition: This rule enforces that only approved shipping plants are selected for an Opportunity. It is triggered when:
    • User Permissions: The user does not have permission to bypass validation rules ($Permission.Bypass_Validation_Rules = FALSE).
    • Shipping Plant Selection: The Opportunity Line Item’s Shipping Plant field (OpportunityLineItem.Shipping_Plant__c) does not match any approved shipping locations associated with the Opportunity.

4. Contribution Margin Calculation Method Consistency

  • Error Message: "Contribution Margin must be set according to the selected Calculation Method."
  • Condition: This rule ensures that the Contribution Margin aligns with the selected calculation method. It activates when:
    • Calculation Method: The Opportunity Line Item’s Contribution Margin Calculation Method field (OpportunityLineItem.SLV5_OPR_CM_Calculation_Method__c) is updated.
    • Contribution Margin: The Contribution Margin (OpportunityLineItem.Contribution_Margin__c) is inconsistent with the selected Calculation Method (either “Percent” or “Amount”).

Flows

Flow Name: Create Product Forecasts

Purpose:
This flow creates a forecast record for each Opportunity Line Item added to an opportunity, ensuring that forecasts are generated and updated based on specific business rules.

Trigger

  • Type: Record-Triggered Flow
  • Event: Triggered each time an Opportunity Product record is created.
  • Entry Conditions: None – the flow runs for all Opportunity Products and executes immediately.

Logic and Flow Steps

  1. Retrieve Existing Forecasts

    • The flow first checks if any forecast records already exist for the Opportunity.
    • It retrieves records from Product Forecast where:
      • SLV_Product__c equals $Record > Product ID
      • SLV_Opportunity__c equals $Record > Opportunity ID
  2. Check for Existing Forecasts

    • Decision: If forecast records exist, the flow ends.
    • If No Forecasts Exist: The flow proceeds to a counter-based decision to manage forecast creation.
  3. Counter Logic and Forecast Creation

    • Counter Check (Counter < 5):

      • If fewer than 5 forecasts exist, the flow:
        • Assigns values to all relevant fields in the forecast record.
        • Sets the Year field to: 
Code Block
TEXT(YEAR(DATEVALUE(DATETIMEVALUE({!SLV7_OPP_Targeted_first_delivery_date}))) + {!counter})
    • Counter Check (Counter ≥ 5):

      • When the counter reaches 5, it stops assigning values and creates the forecast records with the previously assigned field values.
  1. Field Assignments (Set Values)

    • The following fields are populated from the Opportunity Line Item to the Forecast record:
      • Currency ISO Code
      • Opportunity
      • Unit of Measure
      • Opportunity Product ID
      • Product
      • CM Calculation Method
      • Volume
      • Price
      • Contribution Margin (Amount) per UoM
      • Contribution Margin
      • Year
Info
titleException for Oil & Gas GBU
  • For Oil & Gas GBU, an exception is applied:
    • The forecast record for the first delivery year is created with all fields set to 0.


Image Added

Enhancements 

Probability Weighted Contribution Margin:
Jira
serverSyensqo's Jira
serverIdd8efc1ef-48bd-3b4e-8714-ad827f4f059b
keyCPROMOG-12

  • A new field was added to Opportunity product called "Probability Weighted Contribution Margin". 
  • This field calculates potential margin based on opportunity probability: 
Code Block
titleFormula
SLV7_OPR_Contribution_Margin_Tot_Amount__c * Opportunity.Probability
  • Field is not visible on OLI layout but can be added on report by any user who can see the OLI



Image AddedImage Removed