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
Amiya DasAmiya Das 

javascript custom buttons

i want to map the current logged in user id with the Admin_Assistant_Email__c field under Ticket_Request__c object. Following is the code. While executing i am getting 'missing ) in parenthetical' in javascript pop-up alert.

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

var trs = new sforce.SObject("Ticket_Request__c"); 
trs.Id = '{!Ticket_Request__c.Id}'; 
var user = sforce.connection.getUserInfo().userId;

if ('{!Ticket_Request__c.Status__c}' == 'New') { 
if (confirm('Are you Sure ? Once the Ticket Request is canceled, it cannot be resubmitted')) { 

trs.Status__c = 'Cancelled - Unsubmitted'; 
var result = sforce.connection.update([trs]); 
window.location.reload(); 




else if ('{!Ticket_Request__c.Status__c}' == 'Cancelled - Unsubmitted') { 
alert('Ticket request is already cancelled'); 


else if (('{!Ticket_Request__c.Status__c}' == 'Approved - Pending Confirmation') 
 && (user == {!Ticket_Request__c.Admin_Assistant_Email__c})) {
 if (confirm('Are you Sure ? Once the Ticket Request is canceled, it cannot be resubmitted')) { 

trs.Status__c = 'Cancelled - Unsubmitted'; 
var result = sforce.connection.update([trs]);  
window.location.reload(); 





else { 
alert('Only newly created ticket requests can be cancelled'); 

}

Any help would be appreciated. Thanks in advance!!