function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

If this button is an s-control and recommended by Salesforce?

Attached is a button in contact with to change the status of contact, if this solution is recommended by Salesforce, since dml direct from the button.

var con = new sforce.SObject("Contact");
con.Id = '{!Contact.Id}';
con.Contact_Status__c = 'Deactivated';

var result = sforce.connection.update([con]);
if('{!Contact.Contact_Status__c}' == 'Deactivated') {
    alert('Contact has been already deactivated');
} else {
       alert('Contact is deactivated');
      alert('Error : '+result);
sailee handesailee hande
Hi allen.zhangyilun,

S-controls have been superseded by Visualforce pages. After March 2010 organizations that have never created s-controls, as well as new organizations, won't be allowed to create them. Existing s-controls will remain unaffected, and can still be edited. Salesforce recommends that you move your s-controls to Visualforce. 
thanks Sailee, yes, understand this, I'm just cannot fingure if this JavaScript solution is recommended or we have to move to VF solution.