Page tree

1. Overview

The Realized Sales section is part of the Opportunity Product Forecasting functionality, aimed at capturing and managing realized sales for products associated with opportunities. It supports the creation, update, and synchronization of realized sales records (ORSY), linking opportunity line items to forecasted product sales for specific years.

The purpose of this document is to provide an overview of the functionality and design for managing realized sales, including creation, update, and deletion processes based on product forecasts.


2. Scope

This functional design covers the Realized Sales section, focusing on the following features:

  • Opportunity Realized Sales Year (ORSY) Management: Creation and update of ORSY records based on OpportunityLineItems and SLV_Product_Forecast__c.
  • Financial Management: Handling realized sales, prices, volumes, and contribution margins for opportunity products.
  • Synchronization: Processes to keep ORSY records up to date based on changes in product forecasts.

3. Functional Requirements

3.1 Realized Sales Data Creation

The system automatically creates Opportunity_Realized_Sales_Year__c (ORSY) records when a product forecast (SLV_Product_Forecast__c) is created or updated. ORSY records track realized sales for a given opportunity product over a specific year.

Inputs:
  • Product Forecast (SLV_Product_Forecast__c)
    • Opportunity (SLV_Opportunity__c)
    • Product (SLV_Product__c)
    • Forecast Year (SLV_Year__c)
    • Forecast Volume and Price
    • Contribution Margin
    • Currency (CurrencyIsoCode)
Outputs:
  • A new ORSY record is created with the following fields:
    • Opportunity (Opportunity__c): The opportunity to which the realized sales relate.
    • Opportunity Product (Opportunity_Product_Id__c): The specific product line item associated with the opportunity.
    • Forecast Year (Year__c): The year the realized sales are tracked for.
    • Product (Product__c): The product being forecasted.
    • Currency (CurrencyIsoCode): The currency of the forecasted and realized sales.

3.2 Synchronization of ORSY Records

ORSY records are synchronized with their associated opportunity and product line items based on the product forecasts. When changes occur in the forecast data, the corresponding ORSY records must be updated or created.

Trigger Events:
  • Creation or Update of Product Forecast (SLV_Product_Forecast__c):
    • When a product forecast is created, updated, or deleted, the ORSY records associated with the forecast are synchronized. If a new year or product is forecasted, new ORSY records are created. If a forecast is deleted, the corresponding ORSY records are also deleted.
Process Flow:
  1. Mapping Forecast to Opportunity Line Items:
    • The system matches each forecast to an OpportunityLineItem based on the opportunity and product fields.
  2. ORSY Record Creation:
    • For each opportunity line item, an ORSY record is created for each forecast year.
  3. Handling Duplicates:
    • The system checks for existing ORSY records for the same opportunity product and year to avoid duplication. If an existing record is found, it may be updated, not recreated.
Data Synchronization Logic:
  • ORSY records are linked to SLV_Product_Forecast__c and OpportunityLineItem records.
  • The key fields for mapping and synchronization are:
    • Opportunity (Opportunity__c)
    • Opportunity Product (Opportunity_Product_Id__c)
    • Year (Year__c)
    • Product (Product__c)

3.3 Updates to Realized Sales Data

The system supports updates to ORSY records based on changes in the product forecast. Key financial fields, such as price, volume, and contribution margin, are updated if modified in the forecast.

Updatable Fields:
  • Price (SLV_Price__c): Updated from product forecast.
  • Volume (SLV_Volume__c): Updated from product forecast.
  • Contribution Margin (SLV_Contribution_Margin__c): Updated based on changes in the forecast contribution margin.
Non-Updatable Fields:
  • Year (Year__c): Cannot be updated after creation. If the forecast year changes, a new ORSY record is created for the new year.
  • Opportunity and Opportunity Product (Opportunity__c and Opportunity_Product_Id__c): These fields are static once the ORSY record is created. A change in product or opportunity will lead to the creation of a new ORSY record rather than updating the existing one.

3.4 Deletion of ORSY Records

ORSY records are deleted when the corresponding product forecasts are removed. This ensures that orphaned ORSY records do not remain in the system.

Deletion Logic:
  • When an SLV_Product_Forecast__c is deleted, the system identifies and deletes the associated ORSY records.
  • The deletion process involves querying the Opportunity_Realized_Sales_Year__c records linked to the deleted product forecast and performing a bulk delete operation.

4. Process Diagrams

4.1 ORSY Creation Process


Product Forecast (SLV_Product_Forecast__c) Created or Updated | v Match Forecast to Opportunity Line Item (OLI) | v Create or Update ORSY Records for the Forecast Year(s) | v Insert or Update Financial Data in ORSY

4.2 ORSY Deletion Process

mathematic
Product Forecast (SLV_Product_Forecast__c) Deleted 

Find Related ORSY Records (Opportunity_Realized_Sales_Year__c) 

Bulk Delete ORSY Records


5. Validation and Error Handling

  • Validation on Forecast Update: The system prevents updates to realized sales data for closed-won opportunities where the forecast year is less than or equal to the current year.
  • Error Messages:
    • "You can't update the Business Potential for years less than or equal to [Year] when the opportunity is Closed Won."
    • "You can't update the Business Potential when the opportunity is Closed Lost."

6. Assumptions

  • Product forecasts will always have valid opportunities and products linked.
  • There will be no direct user input into ORSY records; they will be generated based on product forecasts.
  • Financial fields such as price and volume will always be valid upon creation or update.

The best way to get IT support is to use the new Service One Platform.