cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create a Custom Lightning Button for Mass Document Generation on a Custom Object

Nintex Employee
Nintex Employee
3 1 1,003

Salesforce Lightning - love it or hate it, it's the future of Salesforce. One common problem DocGen users are facing is being able to create custom buttons that are available in both Classic and Lightning. While you might need to do some tricky work to get a custom Javascript button working, there is one thing that anyone can easily do, and that is to create custom object Mass DocGen buttons. 

 

Here are the steps you'll need to take:

  1. Navigate to your Setup >> Develop >> Visualforce Pages
  2. Click on New
  3. Give your new Visualforce Page a good name. (We recommend the format of "massOBJECT_NAME_HEREDdp"
  4. Copy and paste the code below (you can replace all the default text that shows up when you make a new page with this code) 
    <apex:рage id="massOBJECT_NAME_HEREDdp" standardController="OBJECT_API_NAME_HERE" recordSetVar="records" extensions="Loop.MassRedirectPageExt">
        <c:massRedirect redirectInfo="{!redirectParams}"/>
    </apex:рage>
  5. Replace everything that says "OBJECT_NAME_HERE" and "OBJECT_API_NAME_HERE" with their respective values.
    • If you're not sure what the API Name of the custom object you want this button on is, navigate to the Object's details page: Setup >> Create >> Objects >> Select your object. There you'll see a field called "API Name". That is the value you'll want to use.
  6. Once you've finished making the two updates, hit Save.
  7. Now you can create a new custom button using the Visualforce Page you just created. Navigate to: Setup >> Create >> Objects >> Select Your Object Name >> Button Links and Actions >> NewCapture.JPGA sample of what your custom button settings could look like.
  8. Give the button a name
  9. Under "Display Type", select "List Button", and check the checkbox for "Display Checkboxes".
  10. Under "Content Source", select Visualforce Page
  11. You'll notice a new dropdown appear. Select the name of the new Visualforce Page you created in the steps above.
  12. Hit Save, and add the button to your Search Layout for your custom object!
  13. With that you are done!

A few things to note:

  1. Sometimes it takes Salesforce a moment to register the new page, and you might need to hit refresh on the page for your new Visualforce Page to show up.
  2. You must add the button to List Views (Search Layouts), as you have to select the records you want to generate in mass.
  3. The button will not work on the default "Recently Viewed" list view in Lightning, since Salesforce doesn't allow it to have checkboxes.
1 Comment
Nintex Employee
Nintex Employee

Thank you for always delivering helpful and insightful content!Smiley Happy