Skip to main content Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
Krishan Gopal 님이 #Visualforce에 질문했습니다
I created a Visualforce page to override the standard case view page. I have a custom button "OnlineClosed" on case object that ask for a remark and update 2 field status and stage at case object. The button works fine on the standard case view page, but not at my visualforce page. Does anyone have any idea why this button does not working on the visualforce page? When I click on it, I get a error message "URL No Longer Exists".

 

About Custom Button 

Behavior: Execute JavaScript and Content Source: OnClick JavaScript.

 

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

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

var url = parent.location.href;

var updateRecord = new Array();

var myquery = "SELECT Id FROM Case WHERE Id = '{!Case.Id}' limit 1";

var reason = prompt("Enter reason", "");

result = sforce.connection.query(myquery);

records = result.getArray("records");

if(records[0])

{

var update_Case = records[0];

update_Case.Status = "Closed";

update_Case.Stage__c= "Resolved";

update_Case.Remark__c= reason;

updateRecord.push(update_Case);

}

result = sforce.connection.update(updateRecord);

parent.location.href = url;

Code for Button on VisualForce page is below.

<apex:commandButton action="{!URLFOR($Action.Case.OnlineClosed,Case.id)}" value="Online Closed"/>
답변 2개
  1. 2015년 6월 1일 오전 6:06
    Hi Manjit,

     I create a visualforce page to override the standard case view page and here I'm trying to update 3 fields status(picklist), stage(picklist) and remark (input recevived from user) with the help of custom OnClick JavaScript buttun at case. 
로딩 중
0/9000