Salesforce.com is running a twitter contest asking for selfies of Salesforce1 Apps. The majority of posts Salesforce is receiving are user-centric and I think that is great, but just not the way I am going (for now). I built an app for the Administrator. More specifically, I built one for myself. The reason is pretty simple, during my day I get to do a bunch of different things and most are pretty fun. However, setting up new user is not on that list. This is because there are two typical scenarios:
1) “Hi SFDC Team, please set me up in Salesforce with permissions like my colleague”
2) “Hi SFDC Team, please set me up in Salesforce” Both of these scenarios can get messy fast…and by messy I mean way too many clicks. I did a quick sketch in Visio and found that at a very high level, there are 7 steps involved in the first scenario. That is way too much (In my opinion) for me to do a couple times a week.
Therefore, I decided to make something that will reduce the number of steps AND let me easily share out the process AND can be done via the mobile AND be my entry in the #Salesforce1Selfie contest that hopefully will ensure I can stay somewhere awesome during Dreamforce 14.
There are three basic ingredients to my selfie, which I will go into more detail on in three carriage returns: 1) Flow
2) VisualForce Page (Don’t Panic!)
The flow starts with the basics “Input, Query, and Output” structure. My input is the name / email / id of the clone source. You can search three different ways from just one text box (More on that here, “One (flow) field to rule them all”). The query returns all the information you need to create the user record, which I had found previously while working creating users with the Excel Connector.
I display that information on the confirm screen, which is where the cloned user email / name is entered. The finish button creates the user.
There is one interesting thing I need to call out here. If you were to create the user through the regular method, alias is autogenerated. Not a big deal except that Alias is limited to only 8 digits. I just default it to “NewUser” and will direct the new user to change it. You could do something fancy with workflows if you want. At this point, I have a flow that is crazy handy for use just with in the UI. I do plan on modifying this before I push to production so that the clone user search screen is skipped when launched via custom link on the user page. But what about mobile?
I had decided that I wanted to use flows as an app rather than an action. The reasoning is that while in the webUI I am more than likely going to be launching the flow from a user I have found, but if I am accessing via salesforce1, I will be providing the search criteria myself. Therefore, I need to make an app. To use a flow with in an app or even a page is going to require just a little tiny bit of code. It is such a small amount, I don’t even have to give up my hashtag #ClicksNotCode for this blog posting. There is some official documentation out there that will talk about embedding flows within a visual force page. It is really good stuff and I highly recommend you reading it. I have used both the official method and also just used an iframe. Either way seems to work out just fine. You need to make sure to check the box “Available for Salesforce mobile apps”.
One thing you might notice is that your performance on the mobile device is not the same as in the simulator. I believe this is because the basic iframe / interview code given is making the device work hard to format the flow page. I consulted with Google and found a write up on panya.com that had a couple things I wanted to try. I was able to see a HUGE improvement in load times by putting in a few extra lines of code. Another tip is to just save this code somewhere and use it as your template.
“<apex:page showheader=”false” standardStylesheets=”false”> <html> <Head> <Meta name=”viewport” content=”width=device-width, initial-scale=1″/> </head> <body> <flow:interview name=”Clone_User”/> </body> </html> </apex:page>“ Now that I have my flow and my tab I am nearly ready to roll. I just need to add it to the Salesforce1 navigation. You can find the nitty – gritty here, but it is just as easy as going to Mobile Administration and Mobile Navigation. NOTE! If you do not see your VisualForce tab here, got back and verify that you checked the box “Available for Salesforce Mobile Apps”. Also, I have noticed along with some other caveats, visual force pages that were created before salesforce1 came out are only checked with the Salesforce Touch option. It looks like they cannot be modified to run with in Salesforce1. The punch list is complete at this point. To verify you can use the Salesforce1 simulator (<<Org>>.salesforce.com/one/one.app) or you can also see the results on your mobile device pretty easily by just logging in to your sandbox environment.
I really like how this turned out. In a very small amount of time, I was able to: 1) reduce the amount of clicks in my current process by about 80% 2) Create a nice URL based process 3) Create a mobile app for admin use “on the go” As always, let me know if you have any questions, comments, concerns or interesting ideas you would like me to research! andrew