I want to add a button which apply a brief update in a record in a related list.
As far as I've searched, there is only the possibility of adding a custom button/link in a related list table.
Thanks in advance! Cheers. Endrit.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityI want to add a button which apply a brief update in a record in a related list.
As far as I've searched, there is only the possibility of adding a custom button/link in a related list table.
Thanks in advance! Cheers. Endrit.
You can only add the button to the header of the related list, as opposed to each row. However, you can also enable the option to show checkboxes on the related list, which allows users to check any number of boxes before clicking the button, which allows you to achieve the same effect, just with an extra UI click.
Here's a button that could help you get started:
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
var ids = {!GETRECORDIDS($ObjectType.Contact)};
var records = [];
var record;
if(!records.length) {
alert("Please select at least one record before using me.");
return;
}
while(ids.length) {
record = new sforce.SObject("Contact");
record.id = ids.pop();
record.MyField__c = "Updated";
records.push(record);
}
try {
sforce.connection.update(records);
window.top.location.reload();
} catch(e) {
alert(e);
}