+ Start a Discussion

Custom Button on Standard Object

I want to make a custom button that, when clicked, checks a box (a custom field on a standard object) and then saves the record. 


Do I have to do that via a visual force page, or can it be through some fancy javascript with that button? Thanks a bunch.


In your custom button - 

* behavior = Execute Javascript

* Content source = 'Onclick Javascript

* Body = 


    var fObj = new sforce.SObject("Foo__c");
    fObj.Id = '{!Foo__c.Id}';
    fObj.Status__c = 'Approved';
    var result = sforce.connection.update([fObj ]);

    if (result[0].success=='false') {
    } else {
       alert('You have accomplished fie on foo');