In part 1 (Branding your mobile application) of this series we talked about how to brand the Salesforce1 mobile application to fit your company’s standards. In part 2 (Becoming mobile ready) we met Bob the sailorman salesman and customized the Salesforce organization to make it more mobile friendly. And in part 3 (Global Publisher Actions) we took a look at one of the ways you can add custom functionality to your Salesforce1 mobile deployment – by implementing Global Publisher Actions. In this 4th and final part of the series, we will take a look at one more way to add custom functionality to your Salesforce1 mobile deployment – Object-Specific Actions.
Object-Specific vs Global publisher actions
The main difference between Object-Specific and Global publisher actions is that Object-Specific publisher actions are context aware. They are invoked from a specific record using the publisher icon in the lower right corner of the SF1 mobile app (as opposed to the left hand navigation) and the code to make them work knows which record the user was on when they started the action.
This gives Object-Specific actions the ability to act upon the data contained in the record to perform various actions such as mapping the current Account using a maps application.
Bob is pretty happy with his mobile experience and has been adding Accounts to his VIP list which we built in the last part of this series, but the business is not as pleased. They’ve noticed that Bob has begun adding all of his Accounts to the VIP list, and would like to change the business requirements to have Bob also enter in a justification when he adds an Account to the VIP list. To enable this, we will build an Object-Specific publisher action for Accounts that Bob can use to promote them to his VIP list and enter the justification the business needs.
To do this, we will:
- Remove the VIP checkbox from the form
- Create a new custom field called ‘VIP Justification’ that will store Bob’s input. This will just be a long text field for now.
- Create and configure the Object-Specific action so that Bob can invoke it from an Account record.
- The action will take Bob to a new page which has the justification input field.
- When the page is submitted, the field is saved and the record’s VIP checkbox will be checked.
Step 1 – The customizations
At this point, these customizations should be old hat so I’ll just briefly go through what I did.
I created the new VIP Justification field on the Account object:
I created a workflow that sets the VIP checkbox to true whenever the Account is updated to have text in the VIP Justification text area:
And I updated the form to remove the VIP checkbox from it:
Step 2 – The Justification Page
Next, we need to create the page that will allow Bob to input his justification. Because we just need to display the text box for Bob to be able to input the text, we will use one of Salesforce’s native action types to display a form. We could, however, also write and deploy a custom Visualforce page like we did in the previous post to have more control over the look, feel and exact mechanics of the page.
For now, navigate to Setup > Customize > Accounts > Buttons, Link, and Actions and click New Action:
On the following page, enter in the following values:
The Update a Record type is what will allow us to create a form to present to Bob so that he can enter in his justification. Once he clicks save, the workflow we set up earlier will automatically check the VIP box – no code required!
Once you click Save, the next screen will be the form we want to present to Bob. Edit it so that it only contains the following fields:
Notice how we have to keep the Name field because it’s a required field. For our purposes, this is fine, but if we really didn’t want to display it we could write a custom Visualforce page that would track it in the background and only display the justification text box.
Before we save this, we need to make the Justification field required (no point in going to this page if you’re not going to enter anything…). To do this, hover over the VIP Justification field on the form so that the wrench icon appears, then click it. Next, click the Required checkbox and OK.
Once that is done, click Save.
Step 3 – Giving Bob access to the action.
The last thing we need to do is give Bob access to use the new action we just built. To do this, we need to edit his layout (the Standard User Layout) and add the action to it.
On the resulting page, click Actions in the header and drag the new Action we just created to the Publisher Actions section on the form. Click Save.
Step 4 – Testing it out
Now that we’ve given Bob access to the action, he should be able to start using it! Looking at Bob’s mobile device, we can see:
It’s our new action! If Bob clicks on it:
Bob is presented with the justification page we built. He can enter in a justification and click ‘Submit’ to add the Account to his VIP list.
This concludes our series on Salesforce1 Mobile. If you enjoyed it or found it useful, please let us know in the comments below!
Do you need help with your Salesforce deployment? Thinking about going mobile but aren’t sure what the best way to start is? Contact us! Our team of Salesforce and mobile professionals can help you from planning through deployment and post go-live support.