Documentation

Introduction

Weaver is a template designer and document generation tool, built by Appitek, aimed at helping make it easier for your company to design and manage your documents in one place, as well as help you generate and automate the creation of documents and emails based on your template designs.

Design & Manage

With Weaver Designer, our drag-and-drop template designer, you can say goodbye to having to align an image and text in Microsoft Word, and our versioning system means you can easily access and manage all your template versions from within Salesforce - rather than trying to find out who last edited 'InvoiceTemplateFinal2018.pdf’ and whether you have the most recent version!

Build beautiful templates with the drag-and-drop Weaver Designer

designer

Reuse & Maintain

By using Weaver’s component system, you can easily create components that can be reused across all your templates, saving having to duplicate the same elements of a template every time. For example, say you create Proposal templates, you could keep your Terms & Conditions in a component and use it across all your templates. When you need to change your T&Cs (looking at you GDPR), you only need to update the component, and all templates will automatically use the latest version of that component.

Save time updating multiple documents with Weaver Components

Reusing

Generate & Automate

With the Weaver Helper lightning component, you can easily create documents and emails on the fly, without having to leave the record you are on. If you’re still in Classic you can still use all of Weaver’s automation features through URL buttons, allowing you to setup one-click document generation processes with ease.

Generate documents on the fly with the Weaver Helper component

Generation

Getting set up

Licensing

To get started with Weaver, make sure you have the package installed and assign a license to your Salesforce user. If you have a site-wide license, you don’t need to worry about assigning licenses.

You can assign licenses through Setup > Installed Packages > Weaver > Manage Licenses

Licensing

You'll then need to assign permissions to your users. If you want full access to Weaver, including the designer, assign the user the 'Weaver Admin' permission. Otherwise if you just want a user to be able to use the helper, buttons, and any processes built involving Weaver, they only need the 'Weaver User' permission.

Sending emails

If you plan on using Weaver to build and send emails, you will need to make sure you have the Mass Mail permission enabled for your profile, and ensure that email deliverability access is set to ‘All email’

You can set email deliverability through Setup > Deliverability > Access Level

Sending Emails

Lightning component

The Weaver Helper component can be added to any Lightning Record page. To be able to use the component a user will need Read access for all 4 Weaver objects (Weaver Template, Weaver Template Version, Weaver Component, Weaver Component Version). You will also need Read access on the standard Email Template object (for using the Send as Attachment option)

If you want to use the ‘Save to Feed’ option, you’ll need to make sure the object this component is on has the feed enabled, and that the user is allowed to post, otherwise it won’t work.

Add the Weaver Helper onto any Lightning Record detail page via the Lightning App designer

Lightning Component

Weaver objects

Weaver is made up of three concepts, templates, components, and versions. These are implemented with four objects; Weaver_Template__c, Weaver_Template_Version__c, Weaver_Component__c, and Weaver_Component_Version__c

As an Admin you should not make changes to any of the Weaver records directly, as the Weaver Designer handles this for you.
Editing the records directly may make them unreadable by the designer!

Templates

Weaver Templates are full templates you have designed in the Weaver Designer. Templates have set page sizes, can have headers & footers, and are tied to a specific parent object.

The parent object decides what merge fields are available, as well as what child objects can be used in repeating sections of the template.

When rendered and generated, templates can magically become either become PDFs or HTML Emails, you don’t need to do anything else for this to happen!

Components

Weaver Components are reusable sections of a template you have designed in the Weaver Designer. They do not have set sizes, as they fill the template they are embedded in, and can be tied to a specific parent object, or have no object at all.

If you specify a parent object, you can use merge fields within the component, but your component can only be reused in templates that have the same parent object.

If you don’t specify a parent object, you can’t use merge fields, but your component can be put in any template! This means you could have multiple templates on various objects that all have the same branded header component - change the component and all your templates get updated!

Versions

Both Weaver Templates and Components have Versions. You can have as many versions as you want but only one version can be ‘Active’ at any given time. You can set a version as ‘Active’ within the Weaver Designer.

The ‘Active’ version is the version that will be used when rendering and generating a document or email, so you can use versions to work on new updates to a template or component without affecting the current automation process. Then when you are ready to make the updates live, just set that version as ‘Active’.

Version store the files used by Weaver, including the .weaver files that store the document data.

As an Admin you should not edit or remove the files stored on version records. Doing so will corrupt your files.

Both Templates and Components have a 'Count' field, which stores the amount of times that template or component has been generated by Weaver.

Weaver Designer Introduction

Now we’re sure you’re itching to create your first template, so let’s go straight into how to use the designer! To open the designer first go to the Weaver app (in Classic or Lightning), and then click on the ‘Weaver Designer’ tab. This will take you to the Weaver Designer page.

In Lightning, depending on your browser settings, it may stop Weaver from redirecting you to the designer. If this happens you need to tell your browser to allow redirects for this tab. We only redirect you in Lightning so that we can take away Lightning’s navigation header, as this frees up more space in the designer.

Starting from scratch

When you first open the designer, you’ll be greeted with a file popup that will show any existing templates or components you’ve made. As it’s your first time you’ll need to create a new one, so click on ‘New File’ to get started.

The designer will then load in all the possible objects you have access to, so depending on how large your org is this could take a minute! Once loaded you’ll be able to select the object for this template, and give it a name. Once you’re ready, click create, and you’ll be taken to your new template.

Creating your first Weaver template

New Template

Managing files

If you already have existing templates or components in your org you’ll see a list of them in the file popup when the designer starts. Selecting a template or component will show a list of all the versions made for that file.

When you select a version, you’ll be shown a small preview of that file, as well as the option to ‘Open File’, which will just open that file in the designer.

Managing your templates and components from the file popup

File popup

Right-click on any template or version to be able to Clone or Delete that file. Cloning a version will duplicate the entire Weaver template version and make a new inactive version with the contents of the original. This allows you to keep a version active while working on new changes or updates. Cloning a template does the same thing, but creates a whole new template rather than just a new version.

Right-click to clone or delete templates and versions

Clone files
It is up to you how you manage versions, as each version stores it's data as files, so if you never delete old versions this may start to use up your file storage

Importing files

If you have a template you previously exporting from another instance of Weaver, or have downloaded one of our example templates, then you can import them through the 'New File' button. At the bottom of the popup is a seperate form allowing you to set a name and upload a file. The file must be an exported '.weaver' file, otherwise the import will fail! Click 'Import File' and a new file will be created using the given template file.

Import previously created files, or our example templates!

Import files

Using the Weaver Designer

Once you have creating a new file, or opened an existing version, the designer will load fully, and you’ll be able to start designing.

There are five main sections of the designer; the Toolbar, the Element Bar, the Element Tree, the Element Editor, and the Canvas.

The Toolbar

Access all your files, save your changes, and more from the Toolbar

Toolbar

The Toolbar is the top-most part of the designer. On the left-hand side you’ll see the following options:

Make sure you’re happy with the changes you have made, as when a version is active it’ll be used in any automation processes you have setup!

In the right-hand corner you’ll a button called 'Hide Outlines'. Clicking it simply toggles all the dashed construction lines around each element.

The Element Bar

Drag-and-drop in elements from the Element Bar

Element Bar

The Element Bar is the top-middle part of the designer. On the left you have the name of the file, which can be edited by clicking the pencil icon. In the middle you have a selection of elements that you can drag and drop elements into the Canvas. On the right you can enter a Record Id matching the object of the template, the type of render (PDF / Word / Email) and click the button to open a real-live preview of your template!

For the element buttons that you can drag, each Element has its own different uses and properties as follows:

Text

Text

Used for basic text sections. When any text is highlighted you'll see a text editor appear to allow you to format your text.

Space

Space

Used for adding space between elements. You can't add any text to a space element.

Image

Image

Used for showing images. When selected you'll see a popup appear to let you set the image URL and alt. text.

We recommend you use Static Resources, Documents, or Files to store your images for rendering but you can also use external URLs if you have the host domain whitelisted!

When using External URLs, you MUST add the domain host as a Remote Site in Salesforce. You can do this through Setup -> Remote Site Settings. If you have an image hosted at 'https://www.abc.com/images/example.png', you would need to add 'https://www.abc.com' as the remote site.

Table

Table

Tables allow you to build not only datatables, but are used for layouts as well. To add more rows to a table, right-click the table in the Element Tree and you'll see an option to 'Add Row'. To add cells to a row, again, right-click the row in the Element Tree to see the option to 'Add Cell'

When you select a table cell you'll see the option for a 'col span' and 'row span'. This is how many columns or rows the cell should take up. To see how tables can be used for advanced layouts, check out some of our example templates.

Repeat

Repeat

Used to create repeating sections for child objects of the parent. You can either drag in repeats from the Element Bar, or you can right-click on most elements in the Element Tree and choose to 'Repeat Element'.

When you select a repeat element you'll see a popup allowing you to set the child object the repeat is for, how many children to render, and how to sort the children. Any text elements inside a repeat will show all available merge fields in the Element Editor,for both the parent and child object.

Component

Component

Used to embed Weaver Components that you’ve created. When you select a component you'll be able to choose which component to render from a dropdown list. There is also the option to use a merge field for the component's Id, meaning you could dynamically render different components based on a field or lookup on the parent object.

The Element Tree

Manage all your elements from one place in the Element Tree

Element Tree

While adding Elements into the Canvas, you’ll notice that a list will start to form in the left-hand side panel. This is the Element Tree, and it shows all the Elements within the document.

From the tree you can select any element by clicking on it, which will highlight it in the Canvas, and select it in the Element Editor. right-click on an element to see all available options, including Copy, Repeat, Move Up, Move Down, and Delete.

Right-click an element to see all possible contect actions

Element Tree Context

For elements that have child elements, you’ll see an arrow on the left-side of the element name. Clicking this will toggle whether the child elements are shown in the tree or not.

When building a template you’ll be able to add a new page with the button at the bottom of the tree.

The Element Editor

Edit the styling and properties of each element through the Element Editor

Element Editor

The Element Editor contains 3 sections,the Element Details, Merge Fields, and Page Setup.

Element Details

when you select an element, you'll be able to see all of it's visual properties displayed under the Element Details section, allowing you to change the styles and how the element is rendered.

For width, height, margins, padding, and border size, the default measurement is pixels. You can use percent by adding a '%'.

Render Criteria

Here you can use a very powerful feature - conditional rendering!. By clicking 'Set Render Criteria' you'll get a popup that allows you to set the criteria to decide if this element should be rendered or not. When a template is used in generating a document, all the render criterias for all elements get evaluating, meaning you can have entire sections show or hide based on data in Salesforce!

As well as putting in actual values, you can also use three special values ODD(), which checks if the field is odd, EVEN() which checks if the field is even, and BLANK() which checks if the field is blank or null.

Custom CSS

If you know CSS, you can add custom CSS attributes directly to the element here. The format is the same as you’d expect for CSS, but you don’t need to wrap the attributes in a selector. Only CSS 2 properties are supported, CSS3 properties will be ignored. This is due to Salesforce's PDF engine, Flying Saucer, being on an older version.

Merge Fields

In the ‘Merge Fields’ section of the Element Editor you’ll see a list of all available merge fields for the parent object of the template, as well as all the available Weaver Designer Tags. If you have selected text inside a repeat, you’ll also see the available child object fields.

Clicking any of these fields will insert them into the current position or selection of the cursor.

All merge fields follow the format of {!x.fieldName}, where x is either 'record' (the parent), 'child' (any child record), or 'granchild'. For example you could put {!record.Name} and this will be replaced in the render with the value of the 'Name' field on the parent record.

User Merge Fields

You can also add fields for the user who ran the generation of the document. This means you could append the name of the person using the component or the URL button, or who caused the process builder or trigger to be activated, into the document that is generated.

These follow the same pattern as merge fields but instead of 'record' or 'child', you use '$User'. So if you put {$User.Email} in a template, it would be rendered as the email address of the user who rendered the document. Currently only the fields in the 'Merge Fields' section of the designer are supported.

Page Setup

In the 'Page Setup' section of the Element Editor, you can set the size of the page, the margins, the background colour, whether to add a header / footer to the document, and whether to set a cover page or backing page (no margins for the first and last pages respectively

There are no limits to the variety of page sizes you could come up with!

Page Sizes

The Canvas

See your designs come to life in the canvas

Canvas

The Canvas is where you drag your elements into, and select elements to edit them in the Element Editor. The canvas will show a box for each page in the document, dragging an element onto that box will add it to that specific page.

Each element has dashed construction lines around it’s border to help you see the position and size of the element. You can toggle these on or off with the 'Hide Outlines' button in the top-right of the designer.

Weaver Designer Tags

For certain functionality there are custom Weaver tags that you can use. These are like merge fields but are processed by Weaver in special ways. They all follow the format of %%!SOMETHING%%. You can apply any styling you want to these tags, just like normal text - it’s only the value that is changed.

You can write these yourself, or insert them from the 'Merge Fields' section.

Table of Contents

You can create a Table of Contents using %%!TOC%%. This will generate a table of contents, using all the header tags you’ve set in the document, along with the corresponding page number. In a rendered PDF, if you click one of the table items you’ll be taken to that page.

Headers

You can create a Header to show in your Table of Contents using %%!HEADER:My Header Name%%. You can set the name of the header, after the colon, with any value you like. All Header tags will be used to make the Table of Contents.

Page Numbers

You can show the current page number using %%!PAGENUMBER%%. This will show the page number when in a rendered PDF.

Page Count

You can show the total number of pages using %%!PAGECOUNT%%. This will show the total number of pages when in a rendered PDF

Checkbox

You can turn a true/false checkbox value into a checkbox / empty checkbox image by using %%!CHECKBOX:{!record.field}%%, where {!record.field} is the checkbox field you want to convert.

You can also do a basic conditional inside the checkbox tag, saving you having to do two seperate checkboxes conditionally rendered. For example you could have %%!CHECKBOX:{!record.Type} = Prospect%% which would render a checked checkbox if the 'Type' field has a value of prospect. You don't need to put values in quotes, and you can use the following operators: !, !=, <, >, <=, >=.

Currency

You can turn any number into a currency formated number (i.e. 10000 => 10,000) with %%!CURRENCY:{!record.field}%%, where {!record.field} is the number or currency field you want to convert.

Today

You can get the put the date the document was rendered by using %%!TODAY%%. you can specify the format for the date by adding a format like %%!TODAY=dd-MM-YYYY%%. Any Java Date Pattern Format is valid. If none is specifed the default will be used (dd-MM-YYYY)

Date

You can format any date field into a format of your choosing by using %%!DATE:{!record.field}=dd-MM-YYYY where {!record.field} is a date field. Like the Today tag, you can use any valid Java Date Pattern Format.

Design FAQs

While building documents, you may come across design problems that you are unsure how to implement. We’ve compiled a list of frequently asked design questions below. If you have any other questions, feel free to reach out to us at weaver@appitek.com

Center text vertically

How to I make text centered vertically?

In the Custom CSS section of the Element Editor you can use a CSS property called line-height. This makes the text lines space out to match the given height.

For example if you add a Text element, and give it a height of 200px, if you add line-height: 200px; to the Custom CSS section, the text in the element will become centered vertically.

This only works for single lines of text. For multiple lines you should play with the top and bottom padding values of the element, as otherwise each line of text would be the height given in the line-height property

Missing paragraph breaks

My text isn’t showing the paragraph breaks from a merge field

If using a rich text field value as a merge field, sometimes your paragraph breaks will be ignored, and you end up with a large block of text!

To get around this, in the Custom CSS section of the Element Editor, add the following CSS: white-space: pre-line. This will make the text respect the paragraph breaks, while keeping within the width of its container.

Cover pages

How do I make a cover page?

For the first and last page in a template, under the 'Page Setup' section there is an option for Cover Page and Backing Page. Ticking these will remove margins from the first and last page in the template respectively.

Word export does not support backing pages!

Pagination

How do I put pagination in the footer of a page?

First you will need to show the footer section on your template. You can do this by selecting 'Show Footer' under the 'Page Setup' section.

You will then see a footer element appear at the bottom, and can then drag elements into like you would onto the page. Drag in a Text element and add the following text:%%!PAGENUMBER%% of %%!PAGECOUNT%%

This will get rendered with the page number values to show values as follows: 1 of 3, 2 of 3, 3 of 3 etc.

Background Images

How do I set a background image?

To set a background image, add an image to the document, at the top of the page. Then you just need to add the a CSS property called position. This allows you to set elements in front or behind each other.

So if you added position: absolute; to your image, it would appear behind all the other elements on the page. You will then have to set position: relative; to the other elements or the image will appear in front of the other elements (which is great if you want to use the image as a watermark, but not so great if you don't). To see examples of background images and watermarks, check out some of our example templates.

Rendering documents

Once you’ve built a template, you can start rendering it! There are a whole variety of ways you can render a document, which we will cover, but it’s important to note there are four main ‘types’ of rendering:

You can run these actions by using the Weaver Helper lightning component, URL buttons, Flows, Process designer, or even your own custom Apex code.

Weaver Helper component

This is the easiest way to render documents, and is already setup for your users without you needing to configure anything else. Just add the component to the record detail page you want to see it on, and it’ll handle the rest. In just a few clicks a user can generate any document they like.

The user will see three options, ‘Generate a document’, ‘Send an email’, and ‘Send an attachment’

Add the Weaver Helper component to any record detail page

Weaver Helper

Generate a document

When the user clicks this option they’ll see a list of all Weaver Templates that have been created for the object of the record they are on.

When they select a template and click ‘Next’ they’ll be able to optionally set a name for the template. By default this will use the name of the template.

When they are happy with the name and click ‘Next’ they can choose whether to save the rendered PDF to the record’s Files (the default), or the record’s Chatter feed. Clicking ‘Save’ will then process the action, and refresh the page’s chatter feed or file’s component accordingly.

A newly generated document on a record's feed

Generate a doc

Send an email

When the user clicks this option they’ll again see a list of all the templates available. Once they select a template they can then set an email address of the intended recipient.

When they click ‘Send’, Weaver will generate a HTML email using the given template, and send it to the given email address.

The same document, turned into a HTML email and sent to a customer

Send email

Send an attachment

When the user clicks this option, once again they’ll see a list of all the templates available. Again optionally they can set a file name.

They will then see a list of all the Email Templates in the org which they can use. Once they select this, they can the Id of the intended Contact, Lead, or User.

When they click ‘Send’, Weaver will generate a PDF based on the Weaver template, then send an email using the selected Email Template with that PDF as an attachment.

An attachment sent via the Weaver Helper

Send attachment

URL Buttons

URL buttons allow an admin to create customized dynamic template generation by just writing a simple URL.

You can create URL buttons via Object Manager > Object > Buttons, Links, and Actions > New Button or Link

New button

All URLs start with /apex/aptk_weaver__WeaverURL?, followed by the following parameters:

Some examples of URLs:

Generates a PDF and saves it to the given Account with the name 'My New File'

/apex/aptk_weaver__WeaverURL?recordId={!Account.Id}&templateId=a001r00000rmTmPAAU&actionType=saveToRecord&documentType=PDF&fileName=My New File

Sends an email to 'support@appitek.com' using the given template

/apex/aptk_weaver__WeaverURL?recordId={!Account.Id}&templateId=a001r00000rmTmPAAU&actionType=sendAsMail&emailAddress=support@appitek.com&subjectLine=My Email&replyTo=weaver@appitek.com

You can create multiple different dynamic URL buttons to suit your business processes

URL button

You can use merge fields within a URL, so this means you could do things like have the Weaver template or email address as fields on the record that a user can set before clicking the button!

Flow & Process Builder

You can use Weaver in your Flows and Processes! This means you can easily automate generating documents to suit your business needs, for example when an Opportunity closes, you could send out an email to the client with an attached Invoice PDF you built in Weaver.

For both automations you need to send a special string to the WeaverFlows.runAction method. You’ll be able to see this method in the Apex Class dropdown in both Flow & Process Builder.

Automate Weaver in whatever way you want in your flows & processes

Automation

Depending on the type of action you want to run, you need to set certain variables from the list above, as follows:

Save to record

Save to feed

Save to parent

Send as email

Send as attachment


If all goes well you will receive ‘Success’, otherwise it’ll be an error message.

Custom Apex Code

When writing your own Apex, you can call any of the global methods from the aptk_weaver__WeaverCore class. Depending on the type of render, you’ll need to send specific parameters:

Save to record

Method:
aptk_weaver__WeaverCore.saveToRecord(templateId, recordId, documentType, fileTitle);

Parameters:

Return:
String - returns either ‘Success’ or an error message

Save to feed

Method:
aptk_weaver__WeaverCore.saveToFeed(templateId, recordId, documentType, fileTitle);

Parameters:

Return:
String - returns either ‘Success’ or an error message

Save to parent

Method:
aptk_weaver__WeaverCore.saveToParent(templateId, recordId, documentType, fileTitle, parentId);

Parameters:

Return:
String - returns either ‘Success’ or an error message

Send as email

Method:
aptk_weaver__WeaverCore.sendAsMail(templateId, recordId, emailAddress);

Parameters:

Return:
String - returns either ‘Success’ or an error message

Send as attachment

Method:
aptk_weaver__WeaverCore.sendAsMailAttachment(templateId, recordId, emailTemplateId, emailTo, fileTitle);

Parameters:

Return:
String - returns either ‘Success’ or an error message

General FAQs

General frequently asked questions people have about Weaver. If you have any other questions, feel free to reach out to us at weaver@appitek.com

Bad PDF Previews

When I preview PDFs in Salesforce they look bad, but when downloaded they look fine?

This is due to Salesforce's PDF preview engine. Sadly we have no control over this, but rest assured your documents will look fine when you download them to your machine or sent to a client!

Custom Fonts

Can we use custom fonts in our templates?

Weaver piggyback's Salesforces PDF rendering engine - Flying Saucer. They use an older version of the engine, which means there are certain things that cannot be done, including custom fonts, and CSS3 properties. If Salesforce updates their engine we'll be sure to let you use custom fonts as soon as possible!

Table of Contents in Word

My Table of Contents doesn't load in Word?

As we generate the pages outside of Word, even if we set the page numbers Word doesn't believe us! Instead of your Table of Contents you'll see a text block that says "Table of Contents - Please right-click and select 'Update field'". Doing so will regenerate your Table of Contents.

Backing pages not working in Word

Backing pages still have margins, headers, and footers in Word documents

Word 'DOC' files don't have the concept of backing pages, only title pages. Because of this we can only remove marings, headers, and footers from the cover (title) page.

Wrong image size in Word

Images in my exported Word document are rendering the wrong size

Images will appear as the wrong size unless you give them a fixed width, i.e. '100px' rather than a relative width, i.e. '100%'. Make sure you set the width for your images if planning to export in Word!

Known Issues

The following are issues that we are aware and are currently trying to find ways around the limitations of the platform to solve.

Planned Features

We have a lot of ideas at Appitek HQ of how we can improve Weaver, and we're always listening to feedback from our users!
If you have any ideas of things you think would improve your Weaver experience, let us know at weaver@appitek.com

Features that we definitely want to add are:

About Appitek

At Appitek, our aim is to help make your job easier, by creating simple but powerful Salesforce applications that make you more efficient at what you do. We believe that by creating a better experience through our products and tools, we can help not only help improve your business processes, but your own personal process, helping you save time on long drawn out processes, and focus more on your customers.

With Salesforce as a central technology in our applications, you can be sure that our solutions are stable, scalable, and safe.

You can visit us on our website at www.appitek.com