You need to sign in to do that
Don't have an account?

Need Help with a simple trigger...
I am trying to update opportunitylineitem quantity when the productcode equals a certain value.
I wrote the below trigger as a first pass before I put in more detailed code.
I am receiving a compile error :
Compile Error: Invalid field productid for SObject OpportunityLineItem at line 10 column 86
I highlighted the field that is in question in red.
thanks for ANY help!!!!
trigger convertproductqty on OpportunityLineItem (before insert, before update) {
// string ProdCode;
Opportunitylineitem[] OppLI = Trigger.new;
for(OpportunityLineItem s:OppLI){
if (s.productid != null)
{
string prodcode = [select productcode from pricebookentry where product2id = :s.productid].productid;
if (prodcode == 'AMS300')
{
s.quantity = 999;
}
}
}
}
Check the API Docs for information on standard object fields -
http://www.salesforce.com/us/developer/docs/api/index.htm
"ID of the associated Product object. This field is unavailable as of version 3.0 and is only provided for backward compatibility. The Product object is unavailable beginning with version 8.0. Use the PricebookEntryId field instead, specifying the ID of the PricebookEntry object."