Create a Conditional Watermark
A watermark can be conditioned to appear in a generated document from a checkbox in Salesforce or an option within template.
Edit CSS to enable Watermark
Go to CSS Source View in the template that you want to enable Watermark in, or choose Styles in Home after opening a template.
![image-20240109-075849.png](../__attachments/186155018/image-20240109-075849.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
Scroll until you see @page line, add the following mark-up in the same group, after @top-right-corner { }
@left-middle {content: dyn-function(value=waterMark);z-index: 100;font-family: sans-serif;font-size: 80pt;font-weight: normal;color: gray(0, 0.3);text-align: center;text-transform: uppercase;transform: rotate(-54.7deg);position: absolute;left: 0;top: 0;width: 100%;height: 100%;}
If the condition is from a checkbox field in Salesforce
![image-20240205-122148.png](../__attachments/186155018/image-20240205-122148.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
Since it is a field from Salesforce, it needs to be queried inside the template to work. Go to Home > Main Flow > Initialize > Edit Step > Find the 'record' command that query the main object. If the main object of the template is 'Opportunity' the record command would have 'Opportunity' as its 'type'
![image-20240205-121020.png](../__attachments/186155018/image-20240205-121020.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
![image-20240205-121134.png](../__attachments/186155018/image-20240205-121134.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
Click on it. On the right panel, there is "Fields", click on the three dots next to it
![image-20240205-121332.png](../__attachments/186155018/image-20240205-121332.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
![image-20240205-121404.png](../__attachments/186155018/image-20240205-121404.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
Search and choose the field that needs to be queried inside the template. Check if it appears on the right column. Hit OK.
![image-20240205-121944.png](../__attachments/186155018/image-20240205-121944.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
In a step before the document is generated, add the following commands
![image-20240205-122016.png](../__attachments/186155018/image-20240205-122016.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
Here the variable 'waterMark' will have the text 'WATERMARK' as its value if the Private checkbox is ticked in Salesforce. Otherwise, the variable 'waterMark' will throw a blank value. Between the quotation marks (''), the content can be changed to display differently. For example, 'draft'.
Then Save and Test the template to enable conditional watermark.
If the condition is from an option inside template
Users can also choose multiple options for the final generated documents, for example, a draft document with watermark, or enable a specific option like to do e-signing. To give the user a selection screen to choose from multiple options, a new screen (or sometimes called Form) can be added at the beginning of the workflow. When adding a screen, it will have multiple buttons for drag and drop. You can change the name and title of the form and buttons.
![image-20240205-122316.png](../__attachments/186155018/image-20240205-122316.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
The attributes of the checkbox:
-Name: represents the variable name that holds the value (displayWatermark)
-Value: is the value of the variable that can be used later to define a condition (give it a 'true' value)
-Label: the display text in the screen input
In a step before the document is generated, add the following commands. The commands say if the variable 'displayWatermark' has 'true' as its value, the 'waterMark' will have 'WATERMARK' value. Otherwise, it would be a blank
![image-20240205-123255.png](../__attachments/186155018/image-20240205-123255.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)
Go back to Main Flow and connect arrows appropriately with the steps to enable the users a selection screen to choose before generating a document.
Test to see the final result.
![image-20240109-075949.png](../__attachments/186155018/image-20240109-075949.png?inst-v=9d6b39e2-8006-4101-aa56-781bfe29038c)