• Emelie Hammarberg
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Salesforce Admin
  • DevCore


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies

Hi,

Trying to create a trigger that will populate a field in the opportunity line items before save, however my trigger only populates the opportunity line item once saved. Both fields in the trigger are in the opportunity line item object, is that the issue? 

The reason to why I want to have the field populated before save is to be able to have a field dependency based on product information. If I could use "Product/PricebookEntry" as controlling field for my custom field Services__c that would solve my issue. But as that's not possible, I want to clone the product value to a picklist before save, and use that picklist for the field dependency. 

The oli.Product_Family__c field is a formula field referencing a field in the related product (formula field: TEXT (PricebookEntry.Product2.Family) ).


trigger OLIAUTOFILL on OpportunityLineItem (before insert, before update) {

for(OpportunityLineItem oli: Trigger.new)
    {
     // If you want this for update operation, then check update as well in the below if statement
     if(trigger.isBefore && trigger.isInsert)
     oli.Test_Type__c = oli.Product_Family__c;
    }
}

Hi,

Trying to create a trigger that will populate a field in the opportunity line items before save, however my trigger only populates the opportunity line item once saved. Both fields in the trigger are in the opportunity line item object, is that the issue? 

The reason to why I want to have the field populated before save is to be able to have a field dependency based on product information. If I could use "Product/PricebookEntry" as controlling field for my custom field Services__c that would solve my issue. But as that's not possible, I want to clone the product value to a picklist before save, and use that picklist for the field dependency. 

The oli.Product_Family__c field is a formula field referencing a field in the related product (formula field: TEXT (PricebookEntry.Product2.Family) ).


trigger OLIAUTOFILL on OpportunityLineItem (before insert, before update) {

for(OpportunityLineItem oli: Trigger.new)
    {
     // If you want this for update operation, then check update as well in the below if statement
     if(trigger.isBefore && trigger.isInsert)
     oli.Test_Type__c = oli.Product_Family__c;
    }
}

Hi,

I am currently trying to implement 'Customizable Campaign Influence' in my Developer edition environment, however, when I do so, I am not given the option to add the following related lists to the objects:
  • Add the Campaign Influence related list to Opportunity page layouts.
  • Add the Influenced Opportunities related list to Campaign page layouts.
  • Add the Campaign Results section to Campaign page layouts.
These 3 related lists do not appear on the Opportunity or the Campaign layouts at all. I have followed the following steps:

https://releasenotes.docs.salesforce.com/en-us/winter17/release-notes/rn_sales_features_core_campaign_influence2_setup.htm

And am using a Developer edition with data. I am setup as an Administrator. Can anyone suggest what I am doing wrong?