Create a Conditional Watermark
A watermark can be conditioned to appear based on user selection, or data from Salesforce. This page shows how to create an SVG watermark and apply it to the template.
For example, you can configure a “DRAFT” watermark to appear in the document if the Salesforce status of the relevant record is in “Draft”, “In Review” etc..
This way, if a copy of the document is downloaded or gets shared in any other way, it will have the DRAFT watermark in it.
The following website (or similar) can be used to encode an SVG: https://www.base64encode.org/.
To begin you can use the following svg code:
<svg height="25.7cm" width="17cm" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" height="25.7cm" width="17cm" fill="white"/>
<text x="-15%" y="60%" text-anchor="middle" fill="silver" font-family="monospace" font-size="180" transform="rotate(-45)">DRAFT</text>
</svg>
The above svg code assumes default margins for the template:
![image-20240710-065134.png](../__attachments/186155018/image-20240710-065134.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Click 'Encode' and copy the generated data below it:
![image-20240710-063822.png](../__attachments/186155018/image-20240710-063822.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
In the template, navigate to the ‘Init variables' step within the main flow, and set a variable 'draftSvg’ as:
![image-20240710-064313.png](../__attachments/186155018/image-20240710-064313.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
The value being data:image/svg+xml;base64,+ the generated code above.
Apply the draftSvg variable in the 'Document print style' style sheet:
![image-20240710-080200.png](../__attachments/186155018/image-20240710-080200.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
The output when testing will be as follows:
![image-20240710-094938.png](../__attachments/186155018/image-20240710-094938.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)