Below article will help you to send SMS to a contact role automatically whenever Opportunity stage changes. 

You can also use the below flow and process builder to Send SMS to a particular Contact Role based on his role (Decisionmaker etc.) as well on any field change on Opportunity object by changing the required changes in the criteria.


1.Create a lookup field with Contact on Opportunity named Primary Contact (to store the Contact role name)

2.Create a formula field on Opportunity to pull the contact mobile number/phone number to which you want to send SMS.

3.Create a SMS template which you want to use while sending SMS.

4.Create a XML configuration on Contact which we will be using later to send SMS to Contact role.

FLOW (Contact Role on Opportunity):

A: RECORD LOOKUP (Contact Role Lookup)

1. Go to setup -> flows -> Open a flow 

2. Create Variables named varContactId and varOpportunityId in flows (Variable can be created from Resources tab in flows and select the Input/Output type as Input and Output)

2. Drag and drop the Record lookup screen on the canvas.

3. Name the Record lookup (Contact Role Lookup)

4. Select the lookup object from which you which you will create lookup that is OpportunityContactRole from drop down.

5. Specify the Criteria as IsPrimary equals true and save the Opportunity Id in one of the variable(varOpportunityId) which we created in step 2.

6. Return the ContactId value from opportunity role object and assign it to the variable varContactId and click Ok.

Please refer below screen shot for details :


B : RECORD UPDATE (Update Primary Contact On Opportunity):

1. Drag and drop the Record Update screen on the canvas and name it Update Primary Contact On Opportunity.

2. Select the object on which you want to update field value of contact role that is Opportunity.

3. Store the Id field in the varOpportunityId variable.

4. Update the Primary Contact lookup field with the value of contactId which is stored in varContactID variable. Click ok and save the flow.

5. Activate the flow as we will be using it in our Process builder and only active flows are available on Process builder.

Please refer the below screenshot for details:


Process Builder1 (Updating Primary Contact on Opportunity):

1. Select the object as Opportunity.

2. Define the Criteria as Primary Contact field on Opportunity isNull and save.

Please refer below screenshot for details:


3. Select the action as flows in Immediate action and select the flow which we created  above from the drop down and map the variable (varOpportunityId) with OpportunityId, save it and activate the process builder.

Please refer below screenshot for details:


Once the above process builder is activated test it by creating or editing an existing opportunity having a Primary contact role attached to it. Once you save the Opportunity the Contact role name should be available in the Primary contact field on Opportunity and the mobile number of that particualr contact role should be fetched in the Contact Mobile field. 

Please refer below screen shot for details:


Once the value is fetched correctly you can use the below process builder to send SMS on Opportunity stage change.

Process Builder2 (Send SMS to Primary Contact):

1. Select the object as Opportunity.

2. Specify the criteria as Primary Contact field is not Null and Opportunity stage                 Ischanged is true and save.

Please refer below screenshot for details:


3. Select the action name as Create Record in immediate action and record type as Task.

4. Fill in the below details and save:

    Description : Name of the XML configuration which you created.

    Assigned to : Whom do you want to assign the task. (I have selected Contact Owner)

    Prioirty : Normal 

    Status : Completed

    Subject: Send SMS

    Name Id : ContactId which we will fetch through Primary contact lookup field.

Please refer below screenshot for details:


Activate the above process builder and test the same by changing the Opportunity stage an SMS should be sent to the Contact Role. You can see the SMS unser SMS History and also under the SMS History related list for that particular contact to which SMS was sent.