Knowledge Base > Salesforce > Advanced – Automate Business Process with Process Builder

in Salesforce

In this tutorial, we will build a new process in Process Builder where we will send an SMS reminder the day before a meeting.

 

The steps to build the process in Process Builder:

Step 1 – Build a template of a reminder SMS message in inwise.

Step 2 – Building the Process Builder Processes in Salesforce.

Step 3 – Create and enable automation in inwise.

*Note*

Before you begin, in order to build and run these processes, a new text field must be created on the “Event” object to convert the default date and time field into text.

Example of a field name – “MeetDate”.

In addition, two text fields must be created on the “Contact” object: a meeting date field and a meeting hour field. Examples of names for fields – “appDate” and “appHour”.

Then, the “Meeting Date” and “Meeting Time” fields should be created in inwise as text fields using the inwise field mapping guide.

Finally, these fields must be mapped in inwise for Salesforce addon field mapping.

This guide can be used (section 4).

 

Step 1 – Build an SMS template in inwise

First, we will create an SMS message draft inside inwise which will contain the text and personal fields we want to send.

In the black menu bar on the left side of the screen, click on campaigns.

Under “Common Operations” panel on the right side of the screen, select “Create SMS Campaign”. You can use the “Create an SMS Campaign” guide.

  1. Update the campaign name. For example – “Reminder before meeting”.
  2. Edit and formulate the content of the message.
  3. We recommend adding personal fields to the message. To do this, place the cursor on the position in the message where you want to add the personal field, click on “Add a personal field” and select the relevant field.

We recommend including a link to remove from the mailing list – more information in this guide (step 2 – Add unsubscribe link).

      4. Finally, click Save to save the SMS you created as a draft (we will return to this in the third and final step of the guide).

 

Step 2 – Build the Processes in Process Builder

In Salesforce, enter the Process Builder screen by clicking on “Setup” and in the Quick Search pane type “Process Builder”.

We will build 2 processes:

1. The first process – Will turn on an automation in inwise in order to send the SMS.

2. The second process – The day before the meeting, the date and time field will be converted into a text field, splitting the date and time into 2 different fields and then run the First process.

 

The first process

An Invocable process, which includes an inwise automation activation (Apex operation) by a unique identifier in order to send an SMS message.

Create a new process – Click “New” and define a name for the process, for example – “Send SMS”.

If necessary, a description can be added to the process.

We will define the activation of the process when we call it from another process.

Choose – “It’s invoked by another process”.

When done, click “Save”.

 

Set the process to be performed on an “Event” object by clicking “Add Object”.

Select from the drop-down list on the left – “Event”.

When done, click “Save”.

 

 

At this point, we will add the criteria that we want to check before performing the action.

The conditions can be created according to unique settings and characteristics. In our example, we do not need a condition so we simply run the action.

 

Click on “Add Criteria”, define a name for the condition, for example, “No Criteria”.

Select the option “No criteria – just execute the actions”.

Finally, click “Save”.

 

 

Now, we will add the action we want to take if the criteria is met.

We will select the apex of automation trigger in inwise, which will send an SMS.

 

  1. Click on “Add Action”.
  2. “Action Type” – Select “Apex”.
  3. “Action Name” – Select a relevant name for the action, for example, “Send SMS”.
  4. “Apex Class” field – Clicking on the drop-down list will open a proposal for completion, select Inwise__Inwise Automation Trigger.
  5. “Set Apex Variables” field – Click on “Add Row”.

 

  1. “Field” field – Clicking on the drop-down list, here again, will open a proposal for us, select “trigger_identifier”.
  2. “Type” field – select “Formula”.
  3. “Value” field – Click on “Build a formula”, a white window will open below for the purpose of inserting the formula.
  4. Because we want to add the contact’s information to the SMS (Contact Object), which is linked to an event, we will copy and paste the following formula:

‘[{“RecordID”:”‘+[Event].WhoId+'”,”trigger_identifier”:”‘+”999″+'”}]’

 

The formula transfers the entity associated with an object such as Event – using [Event].WhoId.

In other cases, the contact entity can be moved directly if the object on which the action is performed is a contact – Using [Contact].Id.

Formula:

‘[{“RecordID”:”‘+[Contact].Id +'”,”trigger_identifier”:”‘+”Trigger Identifier”+'”}]’

 

The same goes for the case of Lead – Using [Lead].Id.

Formula:

‘[{“RecordID”:”‘+[Lead].Id +'”,”trigger_identifier”:”‘+”Trigger Identifier”+'”}]’

 

Under ‘Trigger Identifier’ – a unique identifier must be provided for the operation so that we can select that identifier in the automation inside inwise.

Identifier example – 999.

  1. Click on “Use This Formula”. And click “Save”.

 

We have finished the first process, you can now click “Activate” at the top right of the screen to start the process.

Don’t worry, this is an invocable type process and will not run until we call it the second process.

 

The second process

Each time a meeting is created or updated, the day before the meeting, a date and time field will be converted to a text field and broken down into two separate fields under the contact: meeting date and meeting time.

The conversion and decomposition are done in order to move the meeting date and meeting time individually at the contact level (in addition to all the information contained in the contact record and is done by mapping contact fields).

Finally, we will call the first process that will turn on an automation in inwise to send the SMS.

 

Create a new process – click on “New” and define a name for the process, for example, “Meeting Reminder”.

If necessary, a description can be added to the process.

Select the process to run when –  “A record changes”.

When done, click “Save”.

 

 

Set the process to be performed on an “Event” object, and begin when a record is created or edited.

Click on “Add Object”.

Select the drop-down list on the left in “Event”.

Select the process to start when a record is created or edited – “when a record is created or edited”

And finish “Save”.

At this point, we will add the criteria that we want to test before performing the action, again note that each organization can make conditions according to its own unique definitions and characteristics. In our example, we will check that the date and time field is not empty.

  1. Click on “Add Criteria”.
  2. Define a name for the condition, for example, “Check if Exists”.
  3. In the Set Conditions fields, select the event date and time field – called  [Event].StartDateTime, and check that it is not empty by using an operator called “Is Null”,

When its Type is ‘Boolean’ and the value is ‘False’.

  1. In the Advanced field, select ‘Yes’ so that the action does not take place immediately, but later.
  2. Finally, click “Save”.

Now, we will add the action we want to take if the criteria are met. To do this, we will take the following steps:

 

Schedule the action date to be made one day before the date and time of the meeting.

Setting the date and time field conversion to a new text field under the Event, breaking the text field into two different fields under the ‘Contact’:

          Export and update meeting date field.

          Export and update meeting time field.

We will perform these actions by using formulas under the Record Update action.

 

Scheduled Actions

In the ‘Scheduled Actions’ field, click on ‘Set Schedule’ and select the time you want the actions to take place. In our example, one day before the date and time of the meeting.

And click “Save.”

 

 

Convert the date and time into a new text field under the Event:

Under ‘Scheduled Actions’, the option to select ‘Add Action’ will appear.

  1. ‘Action Type’ – Select ‘Update Records’.
  2. ‘Action Name’ – Define an easy-to-identify name for the action. For example, “Text Conversion”.
  3. ‘Record Type’ – Click on the drop-down list, select “Select the Event record that started your process” ([Event]) and click “Choose”.
  4. ‘Field’ field – Select the field we created for formatting the date and time field. In this example “MeetDate”.
  5. ‘Type’ field – Select “Formula”.
  6. ‘Value’ field – click on “Build a formula”, a white window will open for insertion of the formula.
  7. Update the following in the white area:

LEFT(TEXT ([Event].StartDateTime + (3/24)),19)

*Note*

The number 3 must be changed according to the UTC time in your country.

At the time of writing this guide, the time was UTC+3.

  1. Click on “Use This Formula” And finally, Click “Save”.

 

Export and update the meeting date field under the contact:

  1. Create another action, in ‘Action Type’ – Select “Update Records”.
  2. ‘Action Name’ – Define an easy-to-identify name for the action.

For example, “Contact – Meet Date”.

  1. ‘Record Type’ field – click on the drop-down list, select “Select a record related to the Event” – (Name ID) and click “Choose”.
  2. ‘Field’ field – Select the field created for the meeting date under ‘contact’ object. In this example, a field called “appDate”.
  3. ‘Type’ field – Select “Formula”.
  4. ‘Value’ field – click on “Build a formula”, a white window will open for insertion of the formula.
  5. We will update the following in the white area:

LPAD(TEXT(DAY(DATEVALUE([Event].MeetDate__c))),2, “0”) + “-” + LPAD(TEXT(MONTH(DATEVALUE([Event].MeetDate__c))),2, “0”)+”-“+ TEXT(YEAR(DATEVALUE([Event].MeetDate__c)))

 

*Note*

The [Event].[MeetDate] field must be replaced with your formatted text field we created on the Event entity.

 

  1. Click “Use This Formula” And finally, click “Save”.

 

Export and update the meeting time field under the contact:

  1. Create another action, in ‘Action Type’ – Select “Update Records”.
  2. ‘Action Name’ – Define an easy-to-identify name for the action. For example, “Contact – Meet Hour”.
  1. ‘Record Type’ field – click on the drop-down list, select “Select a record related to the Event” – (Name ID) and click “Choose”.
  2. ‘Field’ field – Select the field created for the meeting date under ‘contact’ object. In this example, a field called “appHour”.
  3. ‘Type’ field – Select “Formula”.
  4. ‘Value’ field – click on “Build a formula”, a white window will open for insertion of the formula.
  5. We will update the following in the white area:

LEFT(RIGHT([Event].MeetDate__c,8),5)

*Note*

The [Event].[MeetDate] field must be replaced with your formatted text field we created on the Event entity.

 

  1. Click “Use This Formula” And finally, click “Save”.

To finish, click “Activate” on the top right of the screen to activate the process.

 

Step 3 – Create and enable an automation in inwise

Now all that’s left to do is to create an automation in inwise that will send the SMS.

 

Navigate to inwise system and in the black menu bar on the left side of the screen click on “Automation”.

In the “Common Actions” pane on the right side of the screen, click “Create Automation”.

Scroll down and select Empty Automation.

Hover your mouse over the trigger (blue square) and click on the pencil icon to edit it.

Trigger Type – Select “Custom Trigger”.

Under Additional settings – ‘Identifier’ – Define the unique identifier we used in the process inside Process Builder. Example 999.

And click “Update”.

Hover your mouse over the action (green square) and click the pencil icon to edit it.

Action Type – Select “Send The Recipient An SMS”.

In additional settings – Select the SMS draft we created in advance in step 1.

In our example, the draft is called –  “Reminder before meeting”, then click “Update.”

Click the “Continue” button on the bottom right of the screen.

On the “Publish Settings” screen, enter a name for the automation. For example, “Reminder before a meeting.”

And finally, we hit the “Publish” button on the bottom right of the screen.

 

That’s it! You have finished setting up and running an automation process inwise through the Process Builder.

So what will happen now? Each contact who sets a new appointment (Event) will receive a reminder with the meeting details in an SMS the day before the meeting.

In this way, additional processes can be automated.