One of the great aspects of the Salesforce platform is the variety of tools which can be leveraged to automate key business processes. With Fundamentals, we provide you with invokable code to make automating project creation a snap. Here’s how it works:
- Create a project template.
- Define your business logic.
- Use Process Builder to input your business logic
- Test and Deploy
Create your project template
A project can be saved as a template in two ways: on the project creation screen by selecting “Save as Template” or on the Project Details page from the “Is Template” checkbox.
Next, locate the ID of the project record. This can be found under the Project detail page as an 18 character string at the end of the Salesforce URL.
Define the business logic
Now that the template is created and it’s ID recorded, it’s time to get the white board out and define how and when a project should be automatically created. A common use case among Fundamentals users is to automatically create a project when an opportunity is Closed Won. It’s possible to make this logic quite complex, for example, launching a specific project anytime an opportunity is Closed Won, the deal size is Large, and location is North America. However, we’ll keep it simple and just launch our project when the Opportunity is Closed Won.
Use Process Builder to input business logic
Process Builder is a powerful, easy to use Salesforce tool leveraging a point and click user interface that enables users to, without a software development background, automate their business processes. Automation can be triggered from any standard or custom objects such as Opportunity, Case, or Ticket and can include other criteria such as time delay or creation only when a dollar amount minimum is met.
To create a new process in Process Builder:
Setup → Create → Workflow & Approvals → Process Builder → New
1. Name Process:
Add name, description, and select process to start when “A record changes.”
As an example to help demonstrate, we’re creating a process that uses the Opportunity object to create new projects. when an opportunity is closed won. We’re creating a process that uses the Opportunity object to create new projects.
2. Add Object:
Find appropriate Object → Start process when record is created or edited → Save
3. Define Criteria
Name Criteria and select “Conditions are met,” → Set Conditions.
In the example, a project is made off the Opportunity Object. The criteria is set when an Opportunity has been Closed Won and select the condition that fits your business needs.
If the criteria passes, then the next stage is to follow the arrow that points ‘TRUE’, if it doesn’t then it will follow ‘FALSE’ to the next criteria to be checked or it will end.
4. Call Apex
Specify the all the variables associated with your project.
In our example:
The Project ID is found in the URL that is displayed between the ‘=’ and ‘&’.
The Project name is created from a formula that uses the Opportunity Name and adds the word “Project” at the end.
The desired start date uses a formula that will use TODAY() for the project’s Desired Start Date.
The Related Record ID connects the Opportunity with the new Project.
5. Click Save and Activate
Test and Deploy
Now that the process has been created and set to Active, it’s time to verify that it behaves as expected. To do that, it’s as easy as creating a test opportunity and setting it to Closed Won. If it works correctly, the record will be successfully saved. If there’s an error upon saving the record, then there’s an issue with one or more of the variables found in the Actions section of the process.