Another Salesforce blog!!!

Salesforce, Apex

Execute JavaScript in Salesforce


/*
* Description: Javascript for Reject_RAE button.
* Created by : 
* Author : 
*/
{!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/23.0/apex.js")}
//check if Contact id is same as RAE Id

var recId = '{!Event__c.Id}';
var status = '{!Event__c.Status__c}';

if("{!Event__c.RAEId__c}" == "{!$User.ContactId}"){
var validateComplete = sforce.apex.execute('OUS_GlobalUtilCls', 'validateEventCompletionWS',{eventId:recId});
if(validateComplete == '{!$Label.Amg_Result_Code_All_OK}'){
var clickRes = confirm('{!$Label.OUS_Event_Complete_Msg_4}');
if (clickRes == true) {
window.location.href = '/apex/OUS_EventComplete?Id={!Event__c.Id}&action=edit&recordtypeId={!Event__c.RecordTypeId}';
}
}else{
alert(validateComplete);
}
}else{
alert("{!$Label.OUS_Event_complete_Msg_6}");
}

Leave a Reply

Your email address will not be published.

*