Creating a Document Query with the PV0 Parameter

Created by Docs Made Easy, Modified on Fri, 25 Jul at 7:05 AM by Docs Made Easy


PV0, or Parameter Value Zero, is a critical parameter in the app.

Using the parameter, the app returns data specific to the record you are working with.

For example, if you are gathering Contacts with a query, rather than returning ALL Contacts in your Salesforce org, pass the ID of the master record into the pv0 filter on the query so that only Contacts related to the record you are working with are returned and merged into the document.’

This feature allows the app to return data specific to the record you are currently working with, revolutionizing how data is extracted and merged into your documents.

Functionalities of PV0:

  • Record-Specific Data Retrieval: PV0’s primary function is to filter and retrieve data that is directly related to the master record ID. Instead of returning all data, PV0 allows you to focus on the specific record you are working on.

  • Dynamic Query Filters: PV0 enables dynamic query filters, ensuring that the data pulled into your documents is always up-to-date and tailored to the context of the master record.

Users must use the pv0 parameter to run the query while adding dynamic filters in a query.

If there are multiple filters, then parameter values will be referenced as pv1, pv2, and pv3 going upto N numbers.

Steps to Create a Document using the PV0 Parameter


  • Click on the App Launcher (the 9-dot icon in the top-left corner). In the search box, type "Docs Made Easy" and select the app from the results.

  • Now, you see this Document Setup page we are creating a Custom button. We are creating a Custom button.


  • Click on the “Launch Wizard ”to create a button for your personalized templates for document generation.
  • Now, you will see the screen. Here, you need to 'Add Solution Details' which are the names of your custom buttons.

  • To create a new query, just click on the “ Create New Query ” button.


  • Click the New Query button to open a popup window where you can configure the details of your document query. In this window, you will need to provide the information.
    Note: The Alias field is mandatory. Make sure to enter a unique alias for each query, as it will be used in the template mapping process.


  • Use the Search bar to find the specific fields you want to include in your query. You can search by field label.

  • Now, you can define Filter conditions to narrow down the records returned by your query. Use the filter section to specify one or more conditions based on the fields you've selected.

  • You can use the 'Order By' option to sort the records by a specific field, like Created Date or Name. You can also choose the sort order - Ascending or Descending.

    Use the Limit field to set the maximum number of records to return. For example, if you only want the latest record, set the limit to 1.
  • Now you can see the Add Parameter Option to configure parameters (e.g., PV0, PV1 and so on) directly to define dynamic query filters for your document logic.

  • Assign the pv0 value according to your query and click on the add button. (In this case example :- pv0 = Account.Id)

  • Once everything is set up, click the Save button to finalize your query.

  • Click on the Next button.


  • To view or use the query syntax, click on the Create New Document Template button.


  • A new popup will appear. In this popup, click on the Merge Field Helper button. This tool helps you easily insert the correct merge fields based on the queries you’ve created.

  • In the Merge Field Helper, click on the SOQL Query Fields tab. Then, select the query you created from the list.

  • Simply copy the table and paste it into your Word template where you want the data to appear.

  • After pasting the query syntax into your Word template, make sure to save the document.

  • Click on Upload, and select your saved Word template.Once uploaded, click the Save button to complete the process.

  • Click on the next button.

  After saving the template, you’ll see the Assigned Behavior screen.


  • Add the required Query Parameter (e.g., Record ID or any specific value)
  • Then click the Save button.
  • Once saved, click the Next button to continue.
  • Now, take you to the final step, that is add a button to Page Layout. Now move as directed and click on 'Go to the Page Layouts' button.


  • A different tab will show you the “Page Layout”. Here, click on the Account Layout that you just created.

  • Then, click on the “Mobile & Lightning Actions” button, and find the button you just created.


  • After that, you need to just Drag and Drop that button beside “Post” in Salesforce Mobile and Lightning Experience Actions.


  • Click on the save button.


  • Here, open an account that you want to and click on the button you created.


  • Click on the download (Template).

  • Here is the generated template output.


    We hope this helps!

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article