A few days back, I have received an email from Community member. She asked me, is it possible to auto split Opportunity revenue with Opportunity Team Members, when someone adds new member to Opportunity Team by clicking on Add button (Available under Opportunity Team related list on Opportunity detail page) and not for Add Default Team, as shown in the following screenshot
Business Use case: – Martin Jones is working as System administrator in Universal Container. He receives a requirement from higher management to auto share 1% of Opportunity revenue with, Opportunity team members as soon as they added to Opportunity team. Same time they don’t want to implement this feature when user use Add Default Team button to add a default Opportunity team to an Opportunity.
Solution of above business requirement
There are multiple solutions possible for the above business scenario. You can either use a combination of Flow and Inline Visualforce Page, Flow and Process Builder and few more. We will use Process Builder to solve the above business requirement. Before proceeding you have to understand below-mentioned objects in Salesforce
A) OpportunityTeamMember: -This object represents a User on the opportunity team of an Opportunity.
B) OpportunitySplit: – This object represents credits one or more opportunity team members with a portion of the opportunity amount.
C) OpportunitySplitType: – This object represent provides unique labels and behavior for each split type.
If you haven’t enabled Team Selling in your Salesforce Organization and want to do so, then please have a look of Splitting Credit across Your Sales Team article.
Follow the below instructions to create a Process for the above business requirement
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and click on the Save button
2. Once you are done click on the Save button, it will redirect you to Process Canvas. Click on Object node to add object, Select Opportunity Team Member object, in this case, and set the evaluation criteria. Please refer to the following screenshot for more details
3. Once you are done, click on the Save button it will redirect you to Process Canvas. The next step is to define Process criteria. For this click on Add Criteria node, enter Criteria Name, Set filter conditions (Similar to Rule Criteria in WFR). For Process Criteria select No criteria—just execute the actions! As want to fire our Process every time whenever a record is created irrespective of any criteria, as shown in the following screenshot
4. Once you are done, click on the Save button it will redirect you to Process Canvas. Now we have to add an Immediate action to Split the Opportunity revenue with new Opportunity Team Member. For this use Create a Record action. Use Field Picker to select the field Description and Text Entry field to enter a comment or sentence. Please refer the following screenshot for more information
The next task is to find out Id of split type Revenue (Used in Preceding Screenshot). One possible workaround is to use the Developer Console. Click on Name | Developer Console and run the below SOQL query
Select id,MasterLabel from opportunitySplitType
It will look like the following screenshot
5. Once you are done click on the Save button, it will redirect you to Process canvas. Finally, the Process will look like the following screenshot
Don’t forget to active the Process by clicking on the Activate button
It’s time to test this Process
Now onwards if a business users add new members in Opportunity Team by clicking on Add button (Available under Opportunity Team related list on the Opportunity Detail page, then Process Builder will automatically Share 1% of Opportunity revenue with them.
1. Currently, there are no member in Opportunity Team for Opportunity “Burlington Textiles Weaving Plant Generator” except Opportunity Owner, as shown in the following screenshot
Below is the current status of Opportunity Splits
2. Now we will try to add a new team member in Opportunity“ Burlington Textiles Weaving Plant Generator“ by clicking on Add button, as shown in the following screenshot
It will redirect you to the page from where you can add new members to an Opportunity, as shown in the following screenshot
3. Once you are done, click on the Save button and navigate to the Opportunity Splits related list available on the Opportunity Detail page. 1% of Opportunity revenue is automatically shared with new Team members by Process Builder, as shown in the following screenshot
Note: -Process Builder won’t work if you add members to Opportunity Team by clicking on “Add Default Team“. I will suggest you to implement this first on your developer org test it and then move it to Production.