Functions and Merge Field Case Scenarios
Below are some common use case examples for using functions and merge fields in different areas of Magentrix. Screen capture images have been included to demonstrate the completed configuration for additional reference.
Email templates:
In this example, an email will be created that will use the contact's first name and a line to active page "Sample_BigProject" will be placed.
{!Force__Contact.FirstName},
{!$Organization.OrgURL}/{!ActivePageUrl("Sample_BigProject")}- In the Setup Home page, click Create > Email Template.
- Click New.
- Select HTML and then click Next.
- In the Name field, enter the template name.
- In the Email Message field, enter your message.
- In the same field, enter "{!Force__Contact.FirstName}" to pull the contact's first name.
- In the same field, enter "{!$Organization.OrgURL}/{ActivePageUrl("Sample_BigProject")}" to link the active page "Sample_BigProject".
- Click Save.

Automations:
In this example, an automation is created that will send a notification email to a user when a new task is assigned to them using a formula that pulls the assigned user’s email address.
{!Task.Owner.Email}- In the Setup Home page, click Create > Automations.
- Click New.
- Select Task and then click Next.
- In Criteria, select Created, and any time updated which previously did not meet criteria.
- Enable the automation and then click Save.
- Click the automation.
- In the Automation Tasks pane, click New.
- Select New Email Alert and then click Next.
- Enter an email task name, then enter the sequence order, and then select an email template.
- Click Add Recipient.
- Click Formula, then select TO, and then click Next.
- Enter "{!Task.Owner.Email}".
- Click Add and then click Save.


Layouts:
This example will create a page layout section visible only to system administrators.
{!IsInRole(Administrator)}- In the Setup Home page, click Create > Entities.
- Select an entity and click the Page Layout tab.
- Click the dropdown arrow beside the layout and then click Edit.
- On the sidebar, click Elements and then drag and drop the Section onto the layout designer.
- In the Section Title field, enter a title.
- In the Visibility field, enter "{!IsInRole(Administrator)}".
- Click Ok and then click Save & Close.

Buttons:
In this example, a button is created using a formula, containing a validation which checks to see if the user is an Administrator, to decide which Active Page to load. If the user is Administrator, open the Big Project Details page, otherwise open the Big Project Teaser page.
{!If(IsInRole("Administrator"),ActivePageUrl("BigProjectDetails"),ActivePageUrl("BigProjectTeaser"))}- In the Setup Home page, click Create > Entity.
- Click an entity and then select the Buttons tab.
- Click New.
- Enter a name and label for the button.
- In Button Type, select Detail.
- In Content Type, select URL.
- In the Action textbox, enter "{!If(IsInRole("Administrator"),ActivePageUrl("BigProjectDetails"),ActivePageUrl("BigProjectTeaser"))}".
- Click Save.

<< Functions and Merge Filters - Syntax and Examples | Functions List >>