Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Show Page Sections

Using QVars in a Conga Composer Solution

QVars

QVars (Querystring Variables) allow users to reference the results of Conga Queries as the value of other parameters in the same Composer solution. This means that solutions can pass dynamically queried Salesforce data as inputs to other parameters within the same solution. QVars may also be used in Composer API solutions.

QVar Parameters

There are two QVar parameters used in Composer solutions. QVar0Id and QVar0Format work together to identify both the query to run and the format in which to return the queried data. In addition, each pair can be used up to six (6) times per solution using the format QVar0Id/QVar0Format, QVar1Id/QVar1Format, `QVar2Id/QVar2Format`, etc.

QVar0ID

  • The QVar0Id parameter designates a specific Conga Query record for Composer to execute.
    • The parameter value is the Conga Query Key.
  • This parameter is required to use QVars in a Composer solution.
  • Up to six (6) QVarId parameters can be used in a Composer solution.
    • Each QVar is used as an individual parameter with the format QVar0Id, QVar1Id, QVar2Id, etc.
    • Only one Conga Query may be used at a time with each QVarId parameter.
    • For more information on formatting retrieved data with the QVar0ID parameter, see QVar0ID.

Note: The Conga Query used with a QVar must return only one column of data (i.e. one field) and must not retrieve more than 50 rows of data.

QVar0Format

  • The QVar0Format parameter formats the results of the QVar0Id parameter's executed SOQL Query.
    • The parameter value is a 5 digit code.
  • This parameter is not required for all QVar use cases, but it is required for QVar solutions that return multiple rows of data.
  • Up to six (6) QVar0Format parameters can be used in a Composer solution.
    • Each QVarFormat parameter must be used with a corresponding QVarId parameter, i.e. QVar0Id and QVar0Format, QVar1Id and QVar1Format, etc.
  • QVar0Format is useful for separating multiple retrieved values using delimiters, enclosing retrieved values with apostrophes or quotes, and truncating retrieved record Ids to 15 digits.
    • For more information on formatting retrieved data with the QVar0Format parameter, see QVar0Format.

Using {Qvar} as a Parameter Value

{QVar0} is the variable used to reference the result of a QVar parameter's related SOQL Query. Each {QVar} variable correlates to a specific QVarId parameter.

For example, if QVar0Id references a query to return a Contact Id for use in the EmailToId parameter, use EmailToId={QVar0} in the solution URL to pass the Contact Id into the EmailToId parameter.

Use QVarId parameters in sequential order. For example, if using QVar1Id a Composer solution, you must also use `QVar0Id`. Using the QVarId parameters out of sequential order may result in unstable QVar and Composer solution performance.

QVar Use Cases

The examples below depict common use cases for using QVars in Composer solutions.

Using a Contact ID as an Email Recipient

Use Case: Generate a proposal from an Opportunity and send the email to the related Account's Primary Contact.

  • The EmailToId parameter specifies an email recipient for a Conga Email Template and requires a Contact, User, or Lead record Id as the parameter value. Salesforce's buttons and formula fields allow admins to reference Contacts through lookup fields or Opportunity's Primary Contact Role, but in this scenario the Account's Primary Contact Id is not accessible using only those Salesforce features.
  • An end user could manually search for the correct related Contact record in Composer's email user interface during the document generation process, or an admin could configure the solution to use a QVar to select an email recipient automatically.
  • Because there is not a way to reference the Account Primary Contact's record Id directly from the button or formula on the Opportunity, we will resolve this issue by using a QVar to query the Account's Primary Contact and retrieve the Primary Contact's record Id.
  • Example Object Schema:


  • Build a Conga Query to use as the QVar. Example SOQL Query for our solution:


    Note: The solution URL will reassign AccountId as the pv0 variable and the query is filtered to return only the Contact marked as Primary.
  • Copy the Conga Query's Key value and use it as value of QVar0Id. Associating the query with the QVar0Id parameter makes the result of the query accessible as a variable in the Composer solution. Once defined, the variable is available for use by referencing it as {QVar0}.
  • Example parameter configuration:


    1. The Conga Query Key is referenced with &QVar0Id.
    2. The proposal template Conga Key value is passed into TemplateId and hard-coded as the first template in the merge.
    3. The {QVar0} result is used as the value for the &EmailToID parameter.
  • When a user launches the Composer button and the query executes, the actual 15 digit Salesforce ID of the desired Contact record replaces {QVar0} and the email recipient is automatically selected.

Using a Salesforce Attachment as a Conga Template

Use Case: Merge a product description PDF that is attached to a record as a Salesforce File along with a proposal using Opportunity product pricing.

  • In most solutions, all templates referenced in the document merge are stored as Conga Composer Templates on Conga Template records. The TemplateId parameter is then used to reference the Conga Key values of these Conga Templates to predefine template selection.
  • Some solutions need to include a static document that has been attached as a Salesforce File. Examples:
    • Product description PDFs generated by the marketing team.
    • A candidate's resume to include in a job application packet.
    • A static contract addendum or exhibit.
  • QVars can retrieve the record Id of a Salesforce File record and then reference that Id as a value in the TemplateId parameter.
  • In this use case, users need to generate a proposal using pricing information on the Opportunity, but they also need to include marketing's product description PDF that they attached to the Opportunity Files related list.
    • Build a Conga Query to use as the QVar. Example SOQL Query for our solution:


      Note: Additional filters can be added to only query for Files that contain a certain text string in the name. The Query can also sort by CreatedDate or LastModifiedDate, or only return one result using LIMIT, etc
  • Copy the Conga Query's Key value and use it as value of QVar1Id. Associating the query with the QVar1Id parameter makes the result of the query accessible as a variable in the Composer solution. Once defined, the variable is available for use by referencing it as {QVar1}.
  • Example parameter configuration:


    1. The Conga Query Key is referenced with &QVar1Id.
    2. The proposal template is hard-coded as the first template merged using the &TemplateID.
    3. The {QVar1} result is used as the second value for the TemplateID parameter, separated by a comma.
  • When a user launches the Composer solution, it replaces {QVar1} with an File record ID and then Composer merges both templates. The merged templates may be combined into a single output file or merged separately in a .zip file.

Using Multiple Email Addresses as CC Recipients

Use Case: Dynamically include all Decision Maker Opportunity Contact Roles as CCs on an email.

  • The previous examples used QVars to retrieve single data values (Contact Id and File Id). However, QVars are highly useful for returning a set of data values, such as a list of email addresses that need to be included as additional recipients on an outbound email.
  • When working with multiple values in a QVar, it is almost always necessary to format the result to separate each value by commas or surround each value with quotations. The QVar0Format parameter allows users to format the data returned in a QVar according to their solution's needs.

  • In the example below, a user is on an Opportunity record and needs to email the related Account's Primary Contact (accomplished with the QVar in the first example) in addition to CCing related Contacts with an Opportunity Contact Role of "Decision Maker".

  • Build a Conga Query to use as the QVar. Example SOQL Query for our solution:


    Note: The above SOQL query will return the email addresses of all "Decision Maker" Opportunity Contact Roles on the Opportunity.
  • Example of Decision Makers (Contact Roles) on an Opportunity:


  • Copy the Conga Query's Key value and use it as value of QVar2Id. Associating the query with the QVar2Id parameter makes the result of the query accessible as a variable in the Composer solution. Once defined, the variable is available for use by referencing it as {QVar2}.
  • Insert the QVar2Format parameter into the solution. To separate each email address with commas, the value must be 10000.

  • Example parameter configuration:


    1. The Conga Query ID is referenced with &QVar2Id.
    2. QVar2Format returns all email addresses as a comma-separated list.
    3. {QVar2} sets the EmailCC parameter value.

Using All Three QVar Use Cases to Send an Email - Bringing It All Together

  • Use all three QVars together to create an elegant and streamlined Composer solution:


    1. QVar0 retrieves the Account's Primary Contact and defines it as the primary email recipient.
    2. QVar1 retrieves the product description PDF attached to the Opportunity and combines it with a proposal template as a single PDF document.
    3. QVar2 retrieves the Decision Maker Opportunity Contact Roles and includes them as CC recipients on the email.