How to add the 'Take Ownership' button on a Custom Object's layout


Add the 'Take Ownership' button to your custom object's layout

 Please follow the instructions below to add the 'Take Ownership' button to the custom object's layout.

 

1. Go to Setup | Objects and then select your custom object.

2. Scroll down to the Buttons, Links, and Actions

3. Click on New Button or Link

 

 

4. Label it as Take Ownership

5. Select Display type Detail Page Button

 

 

6. Select Behaviour 'Execute javascript' from the dropdown

 

 

7. Select Content Source 'Onclick javascript' from the dropdown

 

 

8. Paste this piece of code in the given area.

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

try{
    var changeRequestToUpdate = new sforce.SObject("Change_Request__c");

    changeRequestToUpdate.Id = "{!Employees__c.Id}";
    changeRequestToUpdate.OwnerId = "{!$User.Id}";

    var result = sforce.connection.update([changeRequestToUpdate]);

    if(result[0].success == "true"){
        location.reload();
    }
    else{
        alert(
            "An Error has Occurred. Error: " + 
            result[0].errors.message
        );
    }
}
catch(e){
    alert(
        "An Error has Occurred. Error: " + 
        e
    );
}

 

 

 9. Click Save

10. Click Edit in Object Page Layout, on the right side of the page

11. Click on the Buttons, on the next page in the Object Layout section

12. Select and hold Take Ownership and drag down the page until you see a green part of the page

 

 

13. Click Save

 

Please contact us at support@ortooapps.com for any questions.

 

Was this information helpful?
Thankyou. Do you want to add anything else?
Thank you.How can we improve this document?
save

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please make sure you spelled the page name correctly or use the search box.