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
Stavros McGillicuddyStavros McGillicuddy 

Delete query runs from Developer Console, Unexpected Identifier error from button

Why can I get this to run in the Developer Console but not from a custom button?
I get an unexpected identifier error 
 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/32.0/apex.js")}

OpportunityLineItem opp=[Select OpportunityID From OpportunityLineItem WHERE OpportunityId = '0063300000iu2IC'];
delete opp;

sforce.connection.update([record]);
window.location.reload();
Ankit SehgalAnkit Sehgal
Your syntax of executing soql query is wrong.

use var opp=sforce.connection.query("Select  .. from...");

refer this link: https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_more_samples.htm