Ajax (1) Apex Class (12) Apex Trigger (2) Community (2) Home Page (1) HTML (4) Integration (3) JS (7) KB (1) Label (1) Licenses (1) Listing (1) Log (1) OOPs (5) Sharing (1) Static Resource (1) Test Class (3) URI (1) Visualforce (10)

Tuesday 22 April 2014

Re: update field using java scrip

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")} 
var records = {!GETRECORDIDS($ObjectType.Contact)};
if (records[0] == null)
{
    alert("Please select at least one contact")
}
else{
for (var n in records) {
              var contact = new sforce.SObject("Contact");
              contact.id =records[n];
              contact.Status__c="Locked";
              sforce.connection.update([contact]); 
}
   window.location.reload();
}



             Thanks & Regards,
             Krishnanand Gupta
   +91-9410670463,+91-9015574663
        http://www.kg91.weebly.com







On Tue, Apr 22, 2014 at 5:49 PM, Krishnanand Gupta <krishnanand.gupta@gmail.com> wrote:
var contact = new sforce.SObject("Contact");
contact.id ="{!Contact.Id}";
contact.Status__c="Locked";
sforce.connection.update([contact]); 
window.location.reload();

No comments:

Post a Comment