• David Jimenez R
  • 0 Points
  • Member since 2017

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
  • 1
I am building a workflow that will send out an email everytime an Account is created.  I would like the email template to include a link to the newly created account record although I do not see if this is possible.  Has anybody done anything like this?

I'm writing a trigger for new opportunity products to populate a field Product_Category__c (on opportunity lineitem) getting the value from Product_Category_new__c (on Product).

This is my trigger:

trigger SetProductCategory on OpportunityLineItem (after insert) {

            for (OpportunityLineItem opplineitem: Trigger.new){

                         opplineitem.Product_Category__c= opplineitem.PricebookEntry.Product2.Product_Category_new__c;


I get this error message:

execution of AfterInsert caused by: System.FinalException: Record is read-only

I have tried with before insert;in this case there aren't errors but the value Product category it's not saved on Opportunity Line item.


I have found that:

In a after insert trigger is not allowed change field using trigger.new


Please can you suggest a solution for this? i would like to copy the value Product category (Product) on Product Category (Opportunity Product) after the insert of the new opportunity products.

Thanks in advantage for any advice.