Learning to code might be dreadful for a few of us, but all of us would like to tweak something the way we wish. Salesforce CRM could be tweaked too! - with code and without code (just a few clicks) That sounds interesting, right?
In this article, we will cover what Salesforce as a company offers to its developer ecosystem and we will check out some best practices to follow
Salesforce Lightning Platform Explained
Salesforce Lightning Platform is an application development platform wherein developers and non-developers could easily and fastly code apps.
The drag and drop low-code tools within the Lightning platform makes the app building process much easier and faster. They include Lightning App Builder, Lightning Flow, Salesforce DX and Heroku.
The lightning platform also has inbuilt scaling, globalization, process automation, search, and reporting capabilities which makes the life of the developer so easy. For instance, the developer need not write HTML or CSS, they can use Lightning Style Library. Also, AppExchange has a huge collection of apps and components, which can be reused by customers, so that they don't start from scratch. Salesforce has also made every attempt to make app development fun. Their trailhead empowers many developer’s careers with their free badges and guided learning tools.
Salesforce is a trusted platform to build your custom applications or extensions. As of 2019, there are about 5.5M apps built on the Salesforce platform. Trust is built into every layer of the platform - be it Infrastructure, Network, or Application services.
"Salesforce Platform enabled us to build a low-code portal in one day and transform part of the institute into a COVID-19 testing lab." - Alex Ehrenberg - Member, Innovative Genomics Institute Testing Lab
Benefits of Lightning Features
“In 2019, 37% of software developers in Forrester’s worldwide survey were using or planning to use low-code tools. By mid-2020, the survey predicts the number to rise to over 50% of developers”
- Lightning has low code capabilities which help even non-developers to build an application with little or no help. You need not hire a dedicated developer or expand the development team, even an admin could cross-work as a developer.
- For starters, you could build an app in days or weeks and not in months or years. The development lifecycle is reduced to a great extent.
- You could develop customizations that make customers' lives easy and make the overall journey and experience a lot better. Also as a company, they can digitize processes faster and use the latest technologies like Robotics, AI, etc.
Now that we know about the platform, let’s jump to what is Salesforce APEX
Don't forget to check out: Salesforce Development Vs. Traditional Development
What is Salesforce APEX?
APEX is a proprietary language developed by Salesforce themselves which lets developers execute flows, control statements on the Force platform along with Force APIs.
You can use APEX while creating web services for integration, email services for sending emails to customers, custom business logic/process, etc.
Their features include,
- APEX has JAVA like syntax which is familiar to developers
- With APEX you could execute DML statements like INSERT, UPDATE, DELETE like SQL
- APEX is strongly typed i.e., it refers directly to schema objects and their data types
- APEX is built to run in a multitenant environment
- APEX upgrades automatically when a new Salesforce release is out
- APEX has built-in mechanisms for unit testing. They suggest which parts of code is covered and can be better
Development Best Practices
After the new developer experience methodology - Salesforce DX came into the picture in 2017, a lot of emphasis has been made on the development best practices. There is a lot of confusion too - which tools to use, how to plan, etc.
DX includes Salesforce CLI, new sandbox - scratchorgs, and use the best practices prescribed by Salesforce to do source-driven development.
In this section, we will cover a few general development best practices.
1. Plan Development Activities
Jot down where you are today and where you want to reach, followed by the development activities and timeline
2. Understand Architecture First
You need to get a decent understanding of Salesforce APIs, architecture, database, schema before proceeding with development activities.
3. Avoid Redundancy
You need to be all eyes while writing code - not to repeat code. It might slip from your mind and you might trigger the same object over and over.
4. Use Sandbox
Every developer like you can leverage their individual sandbox wherein you can easily track changes and progress. There are different flavors of sandbox with or without data - Developer, Partial or Full, you need to use them wisely based on your needs.
Here’s a quick table with details of the Salesforce plan and Sandbox. Don’t underutilize!
5. Coding Style
It matters a lot that you develop a coding style or follows naming conventions. Make your code easy to read and avoid complicated frameworks, libraries, etc. Add them if you only need them.
You can also set up code reviews so that a new set of eyes views the code and suggest changes. This way there are lesser chances of production issues or downtime.
6. Trigger Frameworks and Modules
You can standardize your code using trigger frameworks. Also, you could split the code into modules and check only the module which has errors (Divide and Conquer). These both can usually bring down development, testing efforts.
7. App Development Tools
This could be crucial. You need to pick the right tool for development based on your needs after proper evaluation of alternatives.
There are paid and free IDEs available in the market. They include Welkin Suite, Illuminated Cloud, Eclipse/Force.com IDE, VS Code, Sublime, Metaforce, etc.
8. Test, Test, and Test
At any cost, you don't want to deploy a code that does not work or mess up your production system. You need to test that the code works in an intended way before going live
If you have to test your code manually, it might take ages. You could have automated test scripts or tools to do the testing for you.
9. Document Everything
It’s human nature to forget what they have done after a while. It’s better to document everything while coding. It can help other admins, developers, or even yourself after a while.
You also need to have control over the changes and to be able to track, audit them for compliance purposes. If it's non-compliant, you can roll back quickly and fix it. For rolling back, ensure you backup your metadata regularly.
You can tweak Salesforce for your business needs with configurations to an extent. If at all, it's not possible with configurations, then there are customizations or custom applications where developers come to the rescue.
You want the developers to make things better and not worse right? Your development team could be at top of their game too - only if you keep it simple, consistent, and follow the development best practices continuously. Hope this article helped you with it!
CloudIdeas also provides development services too, you can take our help and just book a call today and get started with our Experts.