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
petec@i2isyspetec@i2isys 

create case button with IF statement

Hello,

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:
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}')

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}')