1
votes

I am trying to update the status field of the standard salesforce contract object. Since we are using a custom layout, it would be preferable to simply have a button on top to accomplish this. I have tried using the method described at: http://sfdc.arrowpointe.com/2009/01/08/invoke-apex-from-a-custom-button-using-a-visualforce-page/

However my implementation is getting the error: java.lang.IllegalArgumentException: Illegal view ID cancel. The ID must begin with /

Would anyone be able to help with this design without getting into implementation details? Is there an easier way to accomplish this?

2

2 Answers

0
votes

However my implementation is getting the error: java.lang.IllegalArgumentException: Illegal view ID cancel. The ID must begin with /

This is almost certainly a problem with the object that your controller action method is returning.

The example method autoRun() returns a PageReference. What does your method return? It should either be a PageReference or null.

0
votes

A significantly easier way to do this would be to use the AJAX Toolkit directly in your custom button, rather than using Apex. To wit, it would be something like:

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

var contractObj = new sforce.SObject("Contract");
contractObj.Id='{!Contract.Id}';
contractObj.Status='Your New Status Value Here';
var result=sforce.connection.update([contractObj]);

if (result[0].success=='false') {
    alert(result[0].errors.message);
} else {
    location.reload(true);
}