Skip to main content
Full Circle Insights

PopulateOppRevenueObjects

Populate OpportunityRevenue objects after attribution is calculated for a single opp. The method populates the OpportunityRevenue objects by referencing the OpPoints maps. Since it's only calculating attribution for a single Opportunity, only one of the OpPoints maps should be populated when called. OpenOpPoints if the Opportunity specified in opId is open, ClosedOpPoints if closed won, and LostOpPoints if closed lost. 

void populateOppRevenueObjects (        
    Id opId,
    CampaignMember firsttouch,
    CampaignMember lasttouch,
    Decimal Amount,
    Map<Id, List<FCI_CampaignInfluenceAPI.OpportunityRevenue>> OpenOpportunityRevenue,
    Map<Id, List<FCI_CampaignInfluenceAPI.OpportunityRevenue>> ClosedOpportunityRevenue,
    Map<Id, List<FCI_CampaignInfluenceAPI.OpportunityRevenue>> LostOpportunityRevenue,    
    Map<Id, Decimal> OpenOpPoints,
    Map<Id, Decimal> ClosedOpPoints,
    Map<Id, Decimal> LostOpPoints,
    Map<Id, Decimal> totalPointsByOppId)

Parameters

  • opId - ID of an Opportunity whose attribution is calculated
  • firsttouch - The first touch response of the Opportunity specified by the opId parameter
  • lasttouch - The last touch response of the Opportunity specified by the opId parameter
  • Amount - Total revenue to attribute for this opportunity based on the point weightings provided
  • OpenOpportunityRevenue - A map from CampaignMember ID or Campaign ID (key) to a list of OpportunityRevenue objects that define the revenue attribution to the Campaign or CampaignMember by an Opportunity. This map is empty when the method is called and is then populated with detailed information.
  • ClosedOpportunityRevenue - A map from CampaignMember ID or Campaign ID (key) to a list of OpportunityRevenue objects that define the revenue attribution to the Campaign or CampaignMember by an Opportunity. This map is empty when the method is called and is then populated with detailed information if necessary.
  • LostOpportunityRevenue - A map from CampaignMember ID or Campaign ID (key) to a list of OpportunityRevenue objects that define the revenue attribution to the Campaign or CampaignMember by an Opportunity. This map is empty when the method is called and is then populated with detailed information if necessary. 
  • OpenOpPoints - A map from CampaignMember ID or Campaign ID to a Decimal value. The decimal value represents points that are used to get the fraction of revenue (defined by the Amount parameter) that will be attributed to the CampaignMember or Campaign. The fraction is the product of the specified points and the total points (defined by the mapped value of the opId in totalPointsByOppId). This map is used to populate the OpenOpportunityRevenue parameter.
  • ClosedOpPoints - A map from CampaignMember ID or Campaign ID to a Decimal value. The decimal value represents points that are used to get the fraction of revenue (defined by the Amount parameter) that will be attributed to the CampaignMember or Campaign. The fraction is the product of the specified points and the total points (defined by the mapped value of the opId in totalPointsByOppId). This map is used to populate the ClosedOpportunityRevenue parameter.
  • LostOpPoints - A map from CampaignMember ID or Campaign ID to a Decimal value. The decimal value represents points that are used to get the fraction of revenue (defined by the Amount parameter) that will be attributed to the CampaignMember or Campaign. The fraction is the product of the specified points and the total points (defined by the mapped value of the opId in totalPointsByOppId). This map is used to populate the LostOpportunityRevenue parameter.
  • totalPointsByOppId - A map from Opportunity Id to a Decimal value that should equal the sum of all the map values in the OpenOpPoints, ClosedOpPoints, and LostOpPoints parameters.
  • Was this article helpful?