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

Delete all Opportunity Product Line Items syntax - Unknown error parsing query
I'm trying to delete all Product Line Items for an Opportunity via a javascript button.
This gives me an Unknown error parsing query error in the developer Console
This gives me an Unknown error parsing query error in the developer Console
Select OpportunityID From OpportunityLineItem WHERE OpportunityId = '0063300000iu2IC' delete OpportunityID
try below lines of code
If you are doing in query editor of developer console, then DML operations cannot be done in the query editor.
You need to this in Debug --- Open Execute Anonymous code.
Please try below code in Open Execute Anonymous code
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
Your code throws an Invalid left-hand side in assignment message.
This code is on a custom opportunity button and should delete the olis from the current opportunity.
This is how it looks modified.
Your code throws an unexpected identifier error
Here is how it looks on my button
The code runs fine in the Developers Console but I get an unexpected error when I run it from a button
Use below code