You need to sign in to do that
Don't have an account?
LIM AI KHOON
customized button to go to approval page
Hi guys,
I have created a button. When user click to the created button, I want it will redirect user to approval/reject page (as attachement). May I know how?
I have created a button. When user click to the created button, I want it will redirect user to approval/reject page (as attachement). May I know how?
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
var result = sforce.connection.query("SELECT Id FROM ProcessInstanceWorkitem WHERE processInstance.TargetObjectId='{!objectName__c.Id}'");
var approvals = result.getArray("records");
if(approvals != undefined && approvals.length > 0) {
var approvalID = approvals[0].Id;
window.open('/p/process/ProcessInstanceWorkitemWizardStageManager?id='+approvalID);
}
else {
alert("There are no approvals pending.")
}