1

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.

  • I don't think this functionality is available without visualforce or a third party app, but you may be able to get some of the functionality you need using a formula field, which links to an apex page, or something similar. – battery.cord Feb 5 '15 at 14:49
4

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);
}
| improve this answer | |
  • Thank you for your reply. I can't apply this pattern right now, because the guys in my team, decided to go with another solution. Ass soon as I apply it, and test the results, I'll mark the answer ass the solution.Bye! – Endrit Sino Feb 5 '15 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.