+ Start a Discussion

create case button with IF statement


I have a button that works great to send an email template from a case record.
The behavior is Execute JavaScript and the Content Souce is OnClick JavaScript
The code works like this:

I would like to have the button code check first to see if the person has a certain profile ID.

I tried adding this part that is underlined and didn't get a syntax error, but when I use the button, it fires an invalid or unexpected token error.

IF({!User.ProfileId}<>'00e30000000hQcG',alert('You do not have permission to send survey.'),// location.replace('/email/author/emailauthor.jsp?template_id=00X33000001UT4E&p2_lkid={!Case.ContactId}&p3_lkid={!Case.Id}&p3={!Case.CaseNumber}&p26={!User.Email}&retURL=/{!Case.Id}')