You need to sign in to do that
Don't have an account?
Amiya 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!!
{!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!!