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
sri123sri123 

Reg: Field Update

Hi, Morning...

 

I created  a custom application with a list button name "Attended".

When i click on this button i would like to update my field name 'Status' with the field value "Attendend"..

 

Can u help me regarding to this....

 

 

Regards:

REKHA

Imran MohammedImran Mohammed

 Hi,

 

As per my understanding, from the list view you want to update the selected records.

 

Make the changes accordingly with the object and fields you have.

 

In the List button javascript code, add this

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

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

var selectedRecords =  {!GETRECORDIDS( $ObjectType.Common_Usage__c )};

var result = sforce.apex.execute('CommonUsageController','updateStatus',{arg: selectedRecords});

-------------------------------------------------------------------

 

 

You should create a global class and add this method to it.

 

    webservice static string updateStatus(ID[] idList)
    {
        Common_Usage__c[] cuList = [select status__c from Common_Usage__c where id in :idList];
        for(Common_Usage__c cu : cuList)
        {
            cu.status__c = 'Appended';
        }
        update cuList;
        return 'success';
    }
Let me know if you face any issues.
SMasterSMaster

Sir,

 

Can the same logic be implemented with detail page button??