• Sean O'Connell
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I am crearting a pretty simple button but I can not figure out how to get i to work correctly here is what I have


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

if ({!Inspection__c.Appointment_Date__c <= TODAY()})

{
alert("Its Past The Appointment Date and Can not be Canceled");
}

else{ 

var newRecords = []; 
var i = new sforce.SObject("Inspection__c");

i.id ="{!Inspection__c.Id}"; 
i.queue__c = 'Canceled';
i.ownerid = '00G37000000hecW' 
newRecords.push(i); 
result = sforce.connection.update(newRecords); 
window.location.reload();}


This Script works in every sceniario other then if Inspection__c.Appointment_Date__c  is blank.  I am getting an error

"A problem with the OnClick JavaScript for this button or link was encountered:
Unexpected token {"

What I want to happen is the field is empty/Null I want it to run the code not the alert.

Thanks in Advance

Sean
I am trying to create a simple button for notes and attachements on the contact object

So have this
/002/e?parent_id={!Contact.Id}&retURL={!Contact.Id}

but I a  getting Error: Enter a URL that is valid and well-formed

I am not sure what that means or how to fix it 

Thanks

Sean