Add Contact Roles in Salesforce1

If you’ve got a Sales team that works extensively with their mobile phones, then you’ve probably run into the limitation of being unable to add Contacts to your Account or Opportunity Contact Roles.  This is something that common sense would think was available, until you get that dreaded email from an annoyed Sales Rep asking why they can’t add another Contact Role from their phone.  And then you spend 10 minutes making sure you’re not going crazy, because you just assumed they could.  With this post we’re going to go over a quick and easy workaround for this.  We will be specifically solving this for the Opportunity Contact Roles scenario.

SF1 view

Automation Overview:

  1. Inputs for Contact Role received (Action)
  2. Process Builder triggered (Pass inputs into Visual Flow)
  3. Contact Role created in Flow
  4. Add Action to Opportunity Layout

For this solution we have two different options in how we can do it architecturally:

  1. Record Create – Create new Custom Object
  2. Record Update – Use Custom Fields on Account/Opportunity

For me, because some of these fields are similar to other fields you might find on an Opportunity, I am going to go with a new Custom Object.  What fields do we need create in this Custom Object?

  1. Auto Number
  2. Opportunity (Master-Detail)
  3. Contact (Lookup)
  4. Role (Picklist, match Contact Roles)
  5. Primary Contact (Checkbox/Boolean)

Custom Object.jpg

Now that we have our Object ready, we can go create our Action.

Action1.jpg

Keep it on the default, Create a Record, and select Add Opportunity Contact Role (our Custom Object we created).

Action2

Label the Action New Contact Role and then uncheck Create Feed Item.  This stops our action from adding a Chatter Post to our Opportunity.

Action3

My favorite part, write your custom Success Message.

Action4

Lastly, we need to change the Icon to our Custom one.  If you haven’t read my post on the Lightning Design System, now would be the time to do so!  Don’t use the boring default icon, make this your own creation!!

Action5

Now to edit our Layout…  Lets remove Opportunity, because that is implied.

Action6

Lets add in our other fields, and make the Contact and Role required.

Action7

Hit Save, and ignore the Alert message from Salesforce.

Action8

Now, lets create a new Predefined Field Value.

Action9

We want to select our Opportunity field and put in the related .

Action10

Great, we are done with the Action!

We now have to create the Process Builder and Visual Flow.  Let’s get our Flow created first since we can’t Activate the Process Builder without it  (Setup | Create | Workflows & Approvals | Flows).

 

NewFlow.jpg

The first step is going to be grabbing our Record Create.

RecordCreate1.jpg

We now need to create the variables we will use to create the Opportunity Contact Role.

Contact Id

var_ContactId.jpg

IsPrimary (This is a BOOLEAN, not Text)

var_IsPrimary

Opportunity Id

var_OpportunityId

Role

var_Role

Lets make sure everything is correctly mapped inside our Record Create.

RecordCreateFinished

Great!  So lets hit OK and set this as our Starting Element.

startelementset.jpg

 

Now lets drag in our Record Delete.  This is so that we don’t add in extra data to our system.  However, if you want to track the usage of this Action by running reports on this Object, then you can skip ahead to saving the Flow.  Also, if you went with the option to go with using Custom Fields on the Opportunity instead of a Custom Object, you’d want to use a Record Update to reset the values to an empty string.

RecordDelete

Create a variable for the Record Id of the Custom Object record we just created, when our Action is used.

AddContactRoleId

Map it in our Record Delete.

DeleteOpptyContactRole

Connect the elements together to finish our Flow.

FinishedFlow

And lastly we want to Save and then Activate our Flow!

Save OCR Flow

ActivateFlow

Fantastic!  Now we need to setup our Process Builder that fires this Flow.  So lets go create a new Process Builder for this.  (Setup | Create | Workflows & Approvals | Process Builder)

NewPb1.jpg

We want the Process Builder to fire on our Custom Object that we created, Add Opportunity Contact Role, and we want it to fire only when a record is created.

NewPb2

We don’t need to set any criteria here, as we want it to run every time a record is created.

NewPb3

Now we need to map the variables in our Flow to the Values in the Custom Object, using the Type Reference.

NewPb4

Hit Save, then Activate your Process Builder.  You’re done!  Now all that is left is for us to update our Salesforce1 Actions layout!

AddToLayout.jpg

Now open up Salesforce1 and look at your finished product!

SF1 view 1           SF1 view 2         SF1 view 3.jpg

With a simple Flow and Process Builder we are now able to bypass a silly limitation that Salesforce1 currently has.  But, hopefully this won’t be necessary much longer if you vote for this idea: https://success.salesforce.com/ideaView?id=08730000000DpbEAAS

 

7 thoughts on “Add Contact Roles in Salesforce1

  1. Vance Lopez November 16, 2016 / 11:08 pm

    Awesome solution and write up. Thanks, David!

    Like

  2. Anna November 23, 2016 / 4:59 pm

    great solution!

    Like

  3. Mike December 5, 2016 / 2:46 pm

    Deploying this one with one of my clients now! Thanks

    Like

  4. agentgill December 5, 2016 / 2:46 pm

    Thanks David! I am going with this solution this week! Life saver!

    Like

    • David Litton December 12, 2016 / 4:35 am

      Glad it helped out :-)!! Thanks for letting me know it was a helpful post for you!

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s