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
InspectorInspector 

Custom Button that Links to New Record

I've created a custom button for my Products Record which allows the user to open a new Custom Record for an object called Email Campaign. (Different than the standard "Campaign" object.) Here's where I'm at -- would like to know what steps I am missing. Thanks in advance: 

matermortsmatermorts

I'm unfamiliar with the $Action function you're using in your screenshot. The way I would do it is like below.

 

 

This button will instantiate a new Account record. To instantiate a new record for your custom object, just replace 001 with the first three characters from your custom object's Id. To obtain the Id, you can either navigate to the tab you have setup for this object, or query your database for a record from the object. For instance, If a record Id from this object is a0Wd0000000atutEAA, use a0W instead of 001. So your URL would look like this: /a0W/e?retURL=%2Fa0W%2Fo

 

Also in this example, clicking on the cancel button, or saving the new record, will take you to the tab for the custom object. If your object doesn't have a tab, you can go back to the originating record by making the retURL like /{!Account.Id}. So, instead of /a0W/e?retURL=%2Fa0W%2Fo it would be /a0W/e?retURL=/{!Account.Id}. If you just want the user to land on the new record they just created, remove the retURL entirely, so it would look like this: /a0W/e

InspectorInspector

Brilliant -- thanks for the great explanation. This works! One thing -- when I click CANCEL on the new record it takes me to a "URL No Longer Exists" page. Otherwise, if saving as a new record it works fine. Any ideas about this? 

 

Thanks again!

matermortsmatermorts

Not sure right off the top of my head. Can you paste in the URL you're using, or post another screenshot?