Objective:
After reading this article, you will understand how to leverage List Buttons in Salesforce to create form records.
Before you get started:
These articles might be helpful before you read this one:
In the event that you need to create Forms while viewing a record in Salesforce, you might choose to add List Buttons to the Forms related list.
In the example above, we have added three List Buttons to the Forms related list in Salesforce. Each button is explained below:
- The first button comes out of box, exists on every form related list by default, and acts as a way for a user to be able to quickly create a Form record. The button launches the user into a screen where they can pick their desired Form Template, and then, for the selected form template, if there are any field links, the user is then prompted with a screen that allows them to populate the necessary form lookups to make those field links work.
- We configured the second button ourselves in this Salesforce environment. The second button is designed to create a Form record when the user clicks it, but we're merging in the Audit ID into one of the field links in the resulting form so that the end user doesn't have to manually do this. We're obviously using an "Audit" custom object, but this could work for any object that you are using.
/apex/disco__NewFormWizard?Audit__c={!Audit__c.Id}&retURL={!Audit__c.Id}
As you can see, the user clicks the button, they choose the Form Template they wish to use, and the Audit field is automatically populated for them.
3. The third and final button takes things one step further, and populates the Form Template that the form is using. This makes it so that the user clicks the button once, and is immediately taken into the form without having to interact with the Form Template or Field Link lookups at all. The option reduces clicks, but eliminates the ability to flexibly choose which template / field link lookups you intend to use.
/apex/disco__NewFormWizard?templateId=a083k00001f917WAAQ&Audit__c={!Audit__c.Id}&passthroughretURL={!Audit__c.Id}
Again, the new parameter that we've added here is templateId=XXXXXXXXXXXXXXX, making it so that the user doesn't have to define this template themselves.
Pro Tip: That template ID doesn't have to be hardcoded. You might consider setting it dynamically, based on a field on your record, user record, custom metadata, etc.
Parameter |
Comments |
/apex/disco_NewFormWizard? |
If you are creating buttons that are creating Form records in the Salesforce desktop user interface, this parameter will almost always be necessary |
templateId= |
This defines which Form Template will be used for the newly created Form record. This can be hardcoded, or dynamically set. |
retURL= |
Controls where the user goes if they cancel creating the new form. |
passThroughRetURL= |
Controls where the user goes after completing the new form |
FormDetail=true |
Sends the user to the Form Detail page, as opposed to a page where they can edit the new form. You can omit this parameter if you wish for the user to go to the page to complete their newly created form. |
Comments
0 comments
Please sign in to leave a comment.