by Sudipta Deb | Dec 28, 2018 | Kitchener Developer Group, Salesforce
Once again, the start of a brand new year has come upon us. As we enter into new possibilities, may we all be reminded that we have the ability to be, do, and have anything that we want; that there are no mistakes, only lessons; and that the love and happiness we seek is already within our grasp. It’s easy to make resolutions and renew our commitments.
As we begin 2019, my prayer is that we continue to grow and find the space within ourselves to know, beyond all doubt, that there is nothing more that we need to do in order to be complete. We don’t need a new exercise plan, more money, a better job, a new car or a bigger house. All we need is a willingness to allow ourselves to feel good and to be at peace in the present moment. All we need is gratitude for all that we have, and all that we have had the pleasure to be and to experience. That is the starting point from which all other things will flow into our existence.
Thank you for the wonderful support that you have given me through the past year! Wishing you a wonderful new year!
2018 was great journey for me both professionally and personally. I would like to share some really important moments –
- I left Cognizant and joined Appirio Inc., a Wipro company. Leaving Cognizant was really difficult for me, because Cognizant gave me all kind of supports during my Salesforce journey. So Cognizant will always remain special. But Appirio is a company I was always dreaming to be part of. Journey with Appirio is awesome. I met so many great colleagues who are not only great in Salesforce, but more that that, they are great human being. I am enjoying every bit of my Appirio journey.
- I was feeling so bad leaving my Manulife team and I am still missing the team. I met the greatest team ever in Manulife.
- I went to Dreamforce’18. It was HUGEEEEEEE… Again thank you Appirio for giving me the opportunity to be part of Dreamforce.
- I became leader of Kitchener, CA Developer Group and thank you to Salesforce for giving me the option to contribute to our Salesforce Ohana.
Events from Kitchener, CA Developer Group:
by Sudipta Deb | Nov 30, 2018 | Dev Hub, Devops, Salesforce DX, Scratch Org
Scratch Org definition file is getting used to create the shape of your scratch org. I would say it is the blueprint of your scratch org. You can use this definition file to create multiple scratch org from your repository.
Scratch org definitions come from JSON text files that are stored in your project’s repository and directory structure. When an SFDX project is first created, it comes with a config/project-scratch-def.json file that defines an extremely basic org “shape” for an empty scratch org.
That default scratch org likely looks nothing like your production org. You can use it for developing functionality that isn’t dependent on your org’s settings, or you can customize it using the settings that are available as part of the configuration file, or you can script your process to perform Metadata API deploys or other API actions to control settings that DX does not support yet.
Ideally, the combination of your DX source code (including all your programmatic and declarative customization) with your scratch org definition gets you close enough to Prod instance.
This definition file contains three main important information about your scratch org.
- Which Edition? As of Winter’19, it supports Developer, Enterprise, Group or Professional
- Add-on features: Functionalities you want to include while creating the scratch org like communities, StateAndCountryPicklist, LiveAgent etc.
- Settings: Org and Feature settings used to configure Salesforce products, such as nameSettings, ideaSettings, caseSettings, omniChannelSettings.
Let’s dig into a Scratch Org definition file now –
{
"orgName": "Sudipta Deb Company",
"username": "sudipta-test-scratch@sudipta.com",
"adminEmail": "sudipta.deb@gmail.com",
"description": "This is the scratch org created by Sudipta Deb",
"edition": "Enterprise",
"features": ["Communities", "StateAndCountryPicklist", "LiveAgent"],
"settings": {
"orgPreferenceSettings": {
"s1DesktopEnabled": true,
"networksEnabled": true,
"chatterEnabled": true
},
"nameSettings": {
"enableMiddleName": true,
"enableNameSuffix": true
},
"quoteSettings": {
"enableQuote": true
},
"liveAgentSettings": {
"enableLiveAgent": true
},
"omniChannelSettings": {
"enableOmniChannel": true
},
"ideasSettings": {
"enableIdeas": true
},
"caseSettings": {
"emailToCase": true
}
}
}
Now let me explain different parts of this definition file –
- orgName: It is just giving a name of your organization in the scratch org.
- username: username of the scratch org user
- adminEmail: Email address of the Dev Hub user making the scratch org creation request.
- edition: provides the Salesforce edition of the scratch org.
- description: Giving description of the scratch org. It’s a good practice to provide description.
- features: In my example, I am enabling communities, StateAndCountryPicklist, LiveAgent in the scratch org.
by Sudipta Deb | Nov 14, 2018 | Action Plan, Action Plan Template, Financial Services Cloud, Salesforce
In Winter ’19 release, Salesforce introduced Action Plans for Financial Services Cloud. It captures repeatable tasks in templates and then automate the task sequences with an action plan.
Example: Processing Loan application, Customer on-boarding process etc. It will also give you the option to create reports and dashboards to monitor progress and ensure compliance.
It consists of three parts –
Action Plan Template: Power consistent customer experiences with configurable task templates.
Process Automation: Increase productivity by automatically generating tasks with due dates and role based assignment.
Plan Execution: Drive collaboration and complaint task completion with analytics and enforcement of required tasks.
Let’s explain in details –
Action Plan Template
An action plan template is nothing but a list of tasks to complete a business process. In a template, each task is given a priority, the deadlines (the number of days in which it should be completed – data offset), and who is responsible. Then this action plan template is used to create action plans with each task assigned to a user with a completion date.
Below picture will give you a great view of Action Plan Template and Action Plan –
Now let’s start creating one Action Plan:
Pre-requisite
- Permission Set: You need to assign permission set – ActionPlans to the users. Without this permission set, you will not be able to assign action plan task to those users.
- Extra Permission: You can provide below standard object permission so that users can edit and delete action plans-
- Action Plan: Read, Create, Edit and Delete.
- Action Plan Template: Read, Create, Edit, Delete and View All
- Status Field Required: This is required to accurately track and report on action plans based on their status. Set the Action Plan Status as mandatory field in Action Plan layout.
- Action Plan List to Account Page Layout: Add action plan related list in Account Page layout.
- Action Plan Lightning Component: Add the Action Plans List – Financial Services Cloud Lightning Component in the page in a separate tab.
- Setup Nonwork days: Use this option to skip nonwork days when setting up the task completion dates. To do that, you can set the Business Hours and setup company-wide holidays.
Use Case
We will use Action Plan Template to automate new credit card opening processes for financial institute XYZ and then use the template to create the action plan for one of the account.
Action Plan Template
Let’s start by creating the action template and inside the action template below are the tasks –
Against each task, we have the option of whom to assign the task – we have three options (Action Plan creators, any other user, or the account team member role). We can define the number of days to complete the task and priority. Here is the view –
Finally we can publish the action plan template.
Action Plan
Now with action plan template published, we can login to any account and create the new plan using action plan template. Here is the action plan creation for – XYZ Visa Credit Card
What happened at the backend, Salesforce has created all the tasks and assigned to owners based on the task configuration. We can see the same from account’s task view.
Considerations
by Sudipta Deb | Oct 23, 2018 | Advanced Apex, Enterprise Territory Management, Opportunity, Salesforce, Sharing and Visibility, Territory
Assigning Territories to Opportunities can be done manually, but there is an option by which you can automate this process. This blog post is all about writing Apex class to automate the Territory assignment to Opportunity record.
Before I start explaining the Apex code, let me explain two important objects –
- Territory2Type: This represents the category of Territories(Territory2). Every territory must have a Territory2Type. The important field within this object is Priority, which is used in Opportunity filter to assign Territory to Opportunity.
- ObjectTerritory2Association: This represents the association between Territory and Object record, which is Account. This is available only if Enterprise Territory Management is enabled.
The Apex code is written
here in the Salesforce Developer’s guide.
The logic is as follows –
- If the Opportunity’s Account record is assigned to no Territory, then Opportunity’s territory2Id field will be null.
- If the Opportunity’s Account record is assigned to 1 Territory, then Opportunity’s territory2Id field will be assigned to same Territory record.
- If the Opportunity’s Account record is assigned to more than 1 Territories, then Opportunity’s territory2Id field will be assigned to that territory record which is having highest priority.
- If multiple territories are having the same priority, then Opportunity’s territory2Id field will null.
Once you have the apex class written, you can configure the Opportunity Territory assignment filter by going into Setup -> Territory Settings and there providing the apex class name. The screenshot is given below –
Few important point to mention here –
- The class OppTerrAssignDefaultLogicFilter is provided by Salesforce. But you can write your own class to implement logic as per your business need and use that. You need to make sure that you class is implementing TerritoryMgmt.OpportunityTerritory2AssignmentFilter interface.
- This class will execute only for those Opportunities where IsExcludedFromTerritory2Filter = false. This is the field named as “Exclude from the territory assignment filter logic” found in Opportunity record. You need to include this field in Opportunity page layout to select/de-select. Otherwise you can use the api to set the value of field IsExcludedFromTerritory2Filter.
- This apex class can work on maximum 1000 opportunities.
by Sudipta Deb | Oct 21, 2018 | Convert, deployment, learn salesforce, Metadata, Retrieve, Salesforce DX, Scratch Org
With the introduction of Salesforce DX, it creates confusion how can I work with old Salesforce(Non Salesforce DX) projects. In this post, I tried to explain how you can still work with your existing non salesforce dx project code, but get all the benefits of Salesforce DX.
First let’s understand the biggest difference between Salesforce DX and Non Salesforce DX which is that in Salesforce DX we don’t need any package.xml and all the changes will be automatically detected. Basically in Salesforce DX, the project format is different than traditional Non Salesforce DX project format.
In today’s blog post, I will discuss how Salesforce DX can be used without enabling Developer Hub with normal Salesforce instance.
I will be using one my developer org(Non Salesforce DX) for this one.
The first command I will be issuing here is to authenticate my developer org and the command is:
sfdx force:auth:web:login -a SudiptaPersonal
Above command will open the browser where I will be providing my org’s credential and thus authenticating my personal org. With -a, I am here giving alias “SudiptaPersonal” to my developer org. Advantage of setting alias is that going forward, I will be using alias to issue any commands against this org instead of typing username and password every time.
Now I will try to retrieve metadata using package.xml. For that, I stored the package.xml in src folder and now with the below command I will be able to retrieve metadata
sfdx force:mdapi:retrieve -k src/package.xml -u SudiptaPersonal -r ./sourceZip
- -u: I am using alias to execute this command against my Personal Salesforce Org.
- -r: This is the location where the zip file will be stored.
- -k: Location of the package.xml which will be used to retrieve the list of metadata.
Now let’s try to
deploy the metadata using Salesforce DX. I will be using below command to deploy metadata into regular Salesforce instance.
sfdx force:mdapi:deploy -f sourceZip/unpackaged.zip -u SudiptaPersonal -w 10
- -u: I am using alias to execute this command against my Personal Salesforce Org.
- -f: Zip file location containing metadata and package.xml.
- -w: Wait time in minute for operation to complete.
Now I will show how you can convert old project structure to Salesforce DX format. For that, let’s create a blank Salesforce DX project by using the below command –
sfdx force:project:create -n PersonalDXProject
Once the project is created, I will create two folders –
- src: This is the place where I will store package.xml
- sourceInZip: This is the place where the metadata will be downloaded in zip format.
Here is the folder structure –
Next I will issue the below command to
retrieve metadata :
sfdx force:mdapi:retrieve -u SudiptaPersonal -k src/package.xml -r sourceInZip
This will retrieve the metadata in zip format and store in the folder sourceInZip.
Now I will
unzip the metadata and use the below command to convert the code base into Salesforce DX format –
sfdx force:mdapi:convert -r sourceInZip/unpackaged
- -r: Folder containing the unzipped source code
With this command, I will have all my code base converted into Salesforce DX format. Now I will execute the below command to convert Salesforce DX format codebase into Metadata API format so that it can be deployed into Non-Salesforce DX org. The command I will execute is:
sfdx force:source:convert -d convertedCode/ -r force-app/
- -d: Folder where the converted code and package.xml will be stored.
- -r: Folder containing the current Salesforce DX.
With code base converted, I will execute the below
command to deploy this file in my non-salesforce dx org.
sfdx force:mdapi:deploy -u SudiptaPersonal -w 10 -d convertedCode
This process is required to deploy changes from Salesforce DX org(your development environment) to Non-Salesforce DX org (for example: QAT).
Here is the small video showing how to use Salesforce DX to retrieve, convert and deploy metadata into Non-Scratch Org.
Please provide your feedback.