After completing this tutorial, you’ll be able to:
- Add Formula Fields to Youreka Templates
- Update Formula Fields directly from a Youreka Form
Time Required: 10 minutes
Youreka supports Salesforce formula field types. Depending on your use case of the formula in Salesforce, you may want to leverage Youreka to perform calculations or determine when certain actions should occur in Salesforce like workflow triggers or validation rules.
To keep things simple in this tutorial, we will use a formula that combines the field linked First Name and Last Name fields to create the Full Name field. This Full Name field is a custom formula field on the Contact Object in Salesforce, and by adding this field as a question type in Youreka, we will be able to update this field directly from the form.
Add the Custom Full Name Formula to the Contact Object
Don’t have this formula field on your Contact Object? Add it by following these steps:
- Navigate to Setup > Customize > Contacts > Fields
- In the Custom Fields & Relationships section, click New
- Select Formula as the data type and click Next
- Name the field Full Name
- Select Text as the formula return type and click Next
- Copy and paste this formula in the text box:
FirstName + ' ' + LastName
- Check syntax to confirm no errors exist
- Click Next to add any description text, establish Field Level Security, and Save your new formula field
Add the Full Name Formula to your Youreka Template
In the Field Links tutorial, we added a number of questions to the Store Contact Information section, including the First and Last name of the store manager. With our Formula Field, we can add a question that will leverage this custom field so that the full name of the store manager will be visible and we can automatically update that field from a form.
- Navigate to your Arabica Coffee Store Visit Template and delete any previously created forms so that you can edit the template in the Template Builder. The Store Contact Information section should resemble this:
- Drag and drop a new question into the section in the right-hand column, between Store Manager Last Name and Preferred Contact Method.
- In the Edit Question modal, make the following edits:
- Question Text = Full Name
- Type = Field Link
- Field Link Lookup = disco__Form_Contact__c
- Field Link Field = Full Name
- Save the Question. The new section should look like this with the Full Name question included.
- You cannot test formula fields in Preview mode from the template builder. To test the new formula field, save your form template, publish it, and create a new form.
- Link your template to a test Account and Contact in Salesforce. Notice that your Field Linked fields have been prepopulated, including the new Formula Field.
- To test the Formula functionality, alter the test contact’s first name and click the blue arrow to activate the formula. You should see the changes appear instantly within the form.
Leverage other Salesforce Formula Fields
Looking to leverage more Formula Fields in Salesforce? Here is a list of Useful Formula Fields that Salesforce has documented that you could implement in your own organization. You can then add these formula fields to Youreka templates to be updated directly from your forms.