Template Framework

Estimated reading: 2 minutes 4 views

Wattyo Composer works with a custom Template Framework that allows to easily define any dynamic template and also offering a lot of flexibility.

The Context

Each template is rendered based on a specific context. In other words, based on a specific database record. This record is also called Root Record.

Placeholder Syntax

In order to display the value in any place of your template you must add the field name between double curly braces: {{FieldName}}

The engine will replace the placeholder with the value of the field for the specified record.

Traverse Lookup Relationships

It’s also possible to add fields from lookup (1:1 or n:1) relationships up to five levels. For instance, if our root record is a Contact, we could add {{Account.Name}} which will display the Name value for the Contact’s parent account.

 Custom Fields and Relationship Reminder

Note that in this case {{Account.Name}} the Account is the standard API Name for the Account relationship on Contacts, and the Name is a standard field. If we are working with custom relationships don’t forget to use add the suitable prefixes and sufixes. You can find the API name of the fields and relationships in the Object Manager and other tools if you have any doubt. If you are using the Wattyo Template Designer you have the field inspector that will do this job for you.

Summarizing:

  • If you are referring to a Field or Relationship which is part of a package, the API Name will be prefixed with namespace (note the – double underscores). I.e. If you want to refer a relationship for the Wattyo Package, wattyo should be prepended to the field / – relationship name:
    • wattyo__Parent_Account__r
    • wattyoMain_Contactr.wattyoInstagram_Accountc
    • Account.wattyoCustomFieldc
  • If the relationship is a custom one, apart from prepending the namespace in case it applies, you should add the __r suffix (note the double underscore).
    • wattyo__Parent_Account__r: a relationship from a package.
    • CustomRelationship__r: a custom relationship from no namespaced – package.
  • For the fields, in case they are custom you must add the __c (note the double underscore).
    • wattyoCustomFieldc
    • YourProjectCustomField__c

It’s important to remark that the sufixes and prefixes are a standard Salesforce behaviour.

Working with 1:N relationships

In case you want to iterate on 1:N relationships please check the Loop documentation.

Articles

Leave a Comment

       
Euphoria, forever till the end of times

Euphoria

Share this Doc

Template Framework

Or copy link

CONTENTS