Snippets and Snippet Groups
Snippets and Snippet Groups hold the reusable content that allows you to manage the rich content in your documents. You can organize the Snippets into groups within your documents. Snippets are useful for taking reusable content, and using that content across multiple DocGen Packages.
For example, say you have a business contract that needs different clauses for customers in different regions, and maybe for contract values above a certain financial value. Snippets' can have conditions to support this, to make your Document Generation project flexible and powerful to your organizations needs.
There are some differences between Snippets and Snippet Groups and it is important to understand how each of these terms is defined.
-
Snippet - a reusable piece of content, can be rich text, images, etc. These can have conditions applied to them such as, "Only include if account amount > $500". These conditions can be applied using field tags.
-
Snippet Group - a reusable set of Snippets, often used for numbered or bulleted lists in legal clauses. The Snippet Group editor allows you to move these lists around, such as indenting the lists.
-
Linked Snippet Group - when designing your Document Package, you can use a Snippet Group by linking it to the package. When you link a Snippet Group, you can also add conditions to the Snippet Group using filters e.g. "Only show this snippet group if the account region is Europe".
Enable Snippet Tab in Lightning interface
In some instances, users may not see the Snippets tab appearing in the Lightning Designer interface. In these cases the tab needs to be added. Salesforce provides the following documentation for adding tabs to Lightning interface: Add and Customize Tabs on Lightning Pages Using the Lightning App Builder.
Create and link Snippets and Snippet Groups
Snippets can be linked to a Snippet Group which then can be linked to a DocGen Package. After a Snippet Group is linked you can then add the field tag for the Snippet Group to a template. When you generate documents every Snippet created is added to the output, in the order you specified in the Snippet Group.
You can link multiple Snippet Groups to a single DocGen Package, and you can use the same Snippet Group on multiple DocGen Package. For example, you might have a Snippet Group for a contract and another Snippet Group for a service level agreement. You could link both Snippet Groups to a DocGen Package that generates documents for on boarding new customers. Once a Snippet Group is linked to a Document Package you will be provided with field tags associated with that Snippet Group that you an insert into a document template.
-
Click the Snippet tab.
-
Click DocGen Snippet Groups.
-
Click New.
-
Type a name in Snippet Group Name and click Save.
The Connect Existing Snippet Group page appears.
-
Click Create.
-
Open a DocGen Package.
-
From the Snippet Groups related list, click New Snippet Group.
The New Snippet Group page opens with no Snippets selected.
-
Type a name in Snippet Group Name and click Save.
The Connect Existing Snippet Group page appears.
-
Click Create.
-
Open a DocGen Package.
-
From the Snippet Groups related list, click Connect Existing Snippet Group.
-
The Connect Existing Snippet Group page opens.
-
In Snippet Group, type the name of the existing Snippet Group and then click Create.
Conditional filtering on Snippets and Snippet Groups
Setting conditional filters on Snippets and Snippet Groups enables you to tailor the documents you create for your customers based on the data in your organization. You can set these filters at the Snippet level, the Snippet Group level, or both levels.
Filtering at the Snippet Group level
Filtering at the Snippet Group level is helpful if you have multiple Snippet Groups connected to a DocGen Package and you want to dynamically add certain groups based on the record used to generate the documents. For example, if new customers with businesses in California get service level agreement (SLA) documents during customer on boarding, you could create a filter to add the Snippet Group that creates the SLA for only customers in California.
-
Open a DocGen Package.
-
From the Snippet Groups related list, click New Snippet Group.
The New Snippet Group page opens with no Snippets selected.
-
Type a name in Snippet Group Name and click Save.
The Connect Existing Snippet Group page appears.
-
Click Create.
-
Under Filters, take any of the following actions:
-
Click Add Filter to add a filter.
-
Click the Trash icon to remove a filter.
-
Select a value in Object, Field, or Operator to edit a filter.
-
Type or paste a tag in Value to edit a filter.
-
If you have more than one filter, type conditions into Advanced Filter Conditions to refine your filters.
-
In Advanced Filter Conditions, type an operator, an open parenthesis, filter numbers separated by a comma, and a close parenthesis. For example, AND(1,2) finds records that match criteria in both values.
Available operators:Operator Definition AND Finds records that match both values. OR Finds records that match either value
-
-
Open a DocGen Package.
-
From the Snippet Groups related list, click New Snippet Group.
-
From the Snippet Groups related list, click Connect Existing Snippet Group.
-
In Snippet Group field, type the name of the existing component group and then click Create.
-
Under Filters, take any of the following actions:
-
Click Add Filter to add a filter.
-
Click the Trash icon to remove a filter.
-
Select a value in Object, Field, or Operator to edit a filter.
-
Type or paste a tag in Value to edit a filter.
-
If you have more than one filter, type conditions into Advanced Filter Conditions to refine your filters.
-
In Advanced Filter Conditions, type an operator, an open parenthesis, filter numbers separated by a comma, and a close parenthesis. For example, AND(1,2) finds records that match criteria in both values.
Available operators:Operator Definition AND Finds records that match both values. OR Finds records that match either value
-
Filtering at the Snippet level
Filtering at the Snippet level is helpful if you have different sections of a document for different types of customers. For example, if new customers with businesses in California get service level agreement (SLA) documents during customer on boarding, but customers with businesses in Los Osos, California require an SLA with different requirements than other customers in California. You create a filter to add a Snippet with those requirements to the SLA group for only customers in Los Osos, California.
-
In the Selected list, click the Gear icon on the second component.
-
Click Add Filter.
-
Fill out the filter:
-
Select an Object.
-
Select a Field.
-
Select an Operator.
-
-
Enter a value and click Done.
More filters can be added by clicking Add Filter. Conditional logic, such as AND or OR operators can be used under Advanced Filters Conditions.
Using multiple filters
If you add more than one filter, you can add Advanced Filter Conditions. This is filter logic that governs how and when Snippets and Snippet Groups apply to the documents you generate. After adding a filter, the filter is numbered. Your first filter is 1 and your second is 2. You apply advanced filter conditions based on these numbered filters. For example, using the examples above you could further refine these filters with a value of California or CA in the Billing State/Province field.
-
Add filters using any of the methods listed above. If you have been following the examples, you have already have filters created.
-
In Advanced Filter Conditions, type an operator, an open parentheses, filter numbers by separated by a comma, and close the parentheses.
For example, you may have a filter that looks like this: "AND(1,2)". In this example, the filter checks for records that match criteria in both values.
Available operators:
Operator Definition AND Finds records that match both values. OR Finds records that match either value