+ Start a Discussion
BaguiarBaguiar 

Javascript on button SOQL problem

Hi there,

 

I have an error popping up saying " missing ; befor statement ".

I've looked at it several times but can't seem to find where is the missing ";" (semicolon) should be.

 

	{!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}

var result = sforce.connection.query("Select Id From Event where subject = 'Tour' and whoid = '{!Lead.Id}' ");
var records = result.getArray("records");

if (records.length == 0){
window.navigate("https://tapp0.salesforce.com/00U/e?who_id={!Lead.Id}&evt1_lkid=005A0000000IHh8&evt1=Philip+jones&evt5=Tour&evt12=Morgan_Ave&IsReminderSet=1&retURL=%2F{!Lead.Id}");
}
Else{
alert ("There is already a Tour Scheduled for this Lead. Please update the existing Scheduled Tour.");
}

 Thanks for the help!

Best Answer chosen by Admin (Salesforce Developers) 
BaguiarBaguiar

Solved.. I knew it was silly..

 

the "Else { "

needs to be  

"else

{  "

 

anyways...

All Answers

BaguiarBaguiar

Solved.. I knew it was silly..

 

the "Else { "

needs to be  

"else

{  "

 

anyways...

This was selected as the best answer
dheaddhead

javascript is very picky about capitalisation