function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Glen.ax1034Glen.ax1034 

Move Opportunity Product Description from Product2 Description

how do I make this cod work? it dies on the last SOQL statement.

 

trigger Load_Opportunity_Product_Details on OpportunityLineItem (before update) {

  List<PricebookEntry> pTypes = [SELECT Id, Product2Id FROM PricebookEntry];    //pull recordtype Id's and record type names from recordtypes where the sobject is contract
 
  MAP<Id , Id> maprtID_rtName = new MAP<Id , Id>();  //map record type ID's to record type names.
  for(PricebookEntry pTypeObj :  pTypes)
  {
  	mapptID_ptName.put(pTypeObj.id , pTypeObj.id); //for all recordtypes... log id's and record type names.
  }




	for (OpportunityLineItem opplineitem:Trigger.new){
		opplineitem.description = [Select Description FROM Product2 where id = mapptID_ptName.get(opplineitem.PricebookEntryId)];


	}



}

 

Best Answer chosen by Admin (Salesforce Developers) 
VarunSforceVarunSforce

Quick sloution is

 

If users are not allowed to edit "description" on opp prod screen, then just add a formula field on opp prod screen as "PricebookEntry.Product2.Description"

All Answers

VarunSforceVarunSforce

Do you mean copy "Product2 description" to "Opportunity product Description" when new opportunity product added?

 

VarunSforceVarunSforce

Quick sloution is

 

If users are not allowed to edit "description" on opp prod screen, then just add a formula field on opp prod screen as "PricebookEntry.Product2.Description"

This was selected as the best answer
Glen.ax1034Glen.ax1034

http://boards.developerforce.com/t5/General-Development/Formula-fields-in-quot-Multi-Line-Layout-quot-for-Opp-Products/td-p/171558

 

I don't believe that is possible.

 

And yes. I meant copy "Product2 description" to "Opportunity product Description" when new opportunity product added.

Glen.ax1034Glen.ax1034

I stand corrected