Last Updated on June 25, 2017 by Rakesh Gupta
In day today life Sales people switch their job frequently, so to manage their existing or closed deal or lead we have to transfer it to the new owner. Salesforce provides various ways to change Ownership of records from one user to another. But Salesforce doesn’t provide a way to transfer records Ownership using Salesforce1 app. In this article I will show you the way by using it you can develop your own tool for transfer Ownership and it will also work on Salesforce1 app.
Business Use Case
Higher management at Universal Containers wants to develop an application for Salesforce1, from where they can completely transfer record ownership from one user to another user in the mass.
Solution for the above business requirement
Again this is power of Visual Workflow, we will create an app without using a single line of code. Salesforce provides various another tool that you can use for this purpose like Data Loader etc. Our app will completely transfer all records from old user to new user, you can add conditions as per your business requirements. To develop add functionality follow the below instructions
Note: – In this article I will discuss only about mass transfer of records. In similar fashion you can develop an application for transfer single record. I will also provide Unmanaged package of my app so you can play it within your dev org.
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open flow canvas for you
3. Drag and drop a Screen ( Give the name Mass Transfer Record) on the window, add three fields with below details
Name | Data Type | Value | Required |
Object Name | Dropdown List | Account Contact Opportunity |
Yes |
Old Owner | Textbox | Yes | |
New Owner | Textbox | Yes |
It will look like below screenshot
4. On the next Screen we will show the list of old users based on user input on the old user field on Screen-1. Now add one Dropdown List field ( Give the name Old User Name) create a new Dynamic Choice with below details
-
- Select Object User
- Enter criteria IsActive= {!$GlobalConstant.True} and Name = {!Old_Owner} (Screen1 Old Owner input field)
- Save ID in some variable in my case it’s {!OldOwnerID}, same like below screenshot
Repeat same process for New user input field and get all users. Now add one Dropdown List field ( Give the name New User Name) create a new Dynamic Choice with below details
-
- Select Object User
- Enter criteria IsActive= {!$GlobalConstant.True} and Name = {!New_Owner} (Screen1 Old Owner input field)
- Save ID in some variable in my case it’s {!NewOwnerID}.
Finally, Screen-2 will look like below screenshot
5. On the next Screen-3, we will confirm the all details from the user. Do to that Drag and drop a Screen ( Give the name Confirmation) on the window, add one field Display type and add text as shown in the below screenshot
6. Now it’s time to decide which object record user want to transfer. Based on User input for “Object Name” field on Screen-1 we will select the object and transfer the records. To do that add one Decision element and it will auto redirect to respective Record update element as shown in below screenshot
7. The final step is to transfer records for those objects from old user to new user. To do that Drag and drop a Record Update element onto the window, and map the fields as per below screenshot
Repeat same Record Update process for contact and Opportunity object. Finally, our flow will look like below screenshot
Use this app on Salesforce1
- To use this app on Salesforce1 , create a Visualforce Page, Select Available for Salesforce mobile apps check box and embed your Flow and crate a Visualforce Tabs to call it. Bel0w is the sample code for your reference
<apex:page >
<br/>
<Center><Font size ="6" color ="orange">Mass Transfer Records</font></Center>
<br/><br/>
flow:interview name="Mass_Transfer_Records"/>
</apex:page>
Now navigate to Name | Setup | Administration Setup | Mobile Administration | Mobile Navigation
- Add you Visualforce Tabs into selected pane, as shown in below screenshot
It’s time to test this feature
To test this app open your Salesforce1 and navigate to Apps and click on your Tab (Mass Transfer Records) it will open a Visualforce page for you. In this demo I will transfer all account records where the owner is old user (Rakesh Gupta) to the new user(EMEA Sales) and click on Next In our case Screen-1 will look like below screenshot
On the Screen-2 it will show the list of user based on user input on Screen-1. Select the old user and new user from the Drop-down list and click on Next, It will look like below screenshot
On the Screen-3 it will show all the details in same screen and ask for your confirmation, if you are happy click on Next, and it will transfer all record from old user to new user. It will look like below screenshot
Install this app
I am offering this app an Unmanaged package, you can install it from below URL
https://login.salesforce.com/packaging/installPackage.apexp?p0=04t900000004yMA
To install this app replace Login with your Salesforce instance name in my case this url will look like
https://ap1.salesforce.com/packaging/installPackage.apexp?p0=04t900000004yMA
16 thoughts on “Mass Transfer Records Using Salesforce1 App”
emilien
Hi, first thanks a lot for your blog it is very interesting and useful.
A question about this flow, how much records can it handle without hiting the Executed elements at runtime per flow limit of 2000 ?
Would il be possible to move a part of it to an apex class to avoid this limit ?
Thanks for your help !
Rakesh Gupta
Less than 9999
Rakesh Gupta
Use Fast Update element
emilien
Hi Rakesh, thanks for your answer. What type of limit is this number ?
Also if I use Fast Update element I need a sObject collection.
Rakesh Gupta
You are right – you need a SObject Collection to work with Fast elements.
The total number of records processed as a result of DML statements – 10,000.
Refer this article – https://help.salesforce.com/articleView?id=vpm_admin_flow_limits_apex.htm&type=5
Suresh Rajan
Thanks for clarifying Rakesh
Suresh Rajan
Sure. Please check the below link to view the screenshot.
https://drive.google.com/open?id=0B9LEAL97OKsxeHdkczFKM3hpbW8
As you can see, although there is a lot of space at the right, the field value is getting displayed in two lines. My desired output is as shown in the below link
https://drive.google.com/open?id=0B9LEAL97OKsxX0w1SlhlQktmWnc
Is there any way to control this setting?
Thank you for your responses and I highly appreciate it.
Rakesh Gupta
I’ve never tried it before, but I think it is not possible
Suresh Rajan
Thanks Rakesh. As a workaround to display multiple fields, I created a formula field like “Name : <> ; Status : <> ; Created by : <>” and used this field in the Multi Select Checkbox field. Though it helps solve the purpose,I have an issue in the way the field gets displayed. As the length of the field is high, the field value gets displayed in two lines ( although there are spaces to the right of the page). Is there any way we can control this setting?
Rakesh Gupta
Can you post few screenshots and code here ?
Suresh Rajan
Great blog Rakesh. My question – Is it possible to list down all the records of the old owner and select the ones to be transferred to the new owner? Thanks
Rakesh Gupta
Yes you can… In such cases you have to incorporate your logic in above Flow
Suresh Rajan
Thanks Rakesh. I was able to display the list of records using Dynamic Checkbox option. However, just wondering if I could show multiple fields of the records (may be in the form of a table) rather than just name or a single field. This way, it would be easier for the user to select the exact records.
Rakesh Gupta
AFAIK it is possible to create a table in Flow but you can’t make them selectable. The only option is to use Visualforce page
Lori Gordon
This was a great posting. I want to change owner on a Lead with Salesforce1. I was able to follow all your instructions up until where i needed to create a Lead Action to launch the flow, and I couldn’t find a way. All your SF1 examples are for new tabs in SF1. Is there a way to have similar functionality in SF1 than you can with a custom URL Button on the detail record?
Rakesh Gupta
I am not sure about custom button but you can use custom link (Detail page link) so it will appear on the record detail page.