Tag Archives: salesforce data model

Wedid: Automated Energy Savings Certificate (ESC) Calculations


The IPART has a specific formula for the Energy Savings Scheme (ESS) to calculate Energy Savings Certificates (ESC). The company needs to capture the baseline lighting system (current) and compare it with the upgraded lighting system (proposed). The current calculation is done using excel and it poses some challenges:

  • the calculation is not accurate because not all scenarios are considered
  • not extensible
  • difficult to track the itemised calculations


  • Capture current and new lighting system in Salesforce
  • Calculate saved MWH and ESC
  • Calculate the estimated ESC money value and prepare a ROI report to end customer in quote

Related Objects Opportunity, Quote, Custom Object
Components Apex Class, Apex Trigger, Visualforce Page, Data Model Design
Complexity Complex

Wedid: Custom Quota Module


Salesforce can forecast sales per month/quarter/year per user. However this customer has a complex forecast module that works like this. 

They have different segments of business. For example: 
– Segment #1 
– Segment #2 
– Segment #3 

There are many sales user: 
– John Doe 
– Fred Smith 

They would like to create separate quota that looks like this: 
John Doe@Segment #1 = $100,000 
John Doe@Segment #2 = $150,000 
Fred Smith@Segment #1 = $250,000 
Fred Smith@Segment #2 = $150,000 
Fred Smith@Segment #3 = $200,000


  • To create custom object to cater for quota per user per segment per month/quarter/year
  • Automatically link opportunity based on custom quota

Related Objects Opportunity, Custom Object
Components Visualforce Page, Data Model Design
Complexity Moderate

Wedid: Course Enrolment System


Our customer’s business is to provide training courses to clients. They have to manage all the available courses, students, enrolments, and also the trainers in one system to ensure all the information is kept correctly. What they would also like is to have is the ability to find out who is the available trainers and allocate the session to them. By using Salesforce, they hope to get this system set up in a more efficient manner.


Setting up Course Enrolment System inside Salesforce. Also, get the time of the courses to be displayed in Calendar view which will help in allocating time to any available trainer.

Related Objects Custom objects
Components Data model design and configuration
Complexity Moderate

Salesforce Automating Record Sharing Based On Dynamic User Field Value


Case sharing rules is set to private. Customer would like to share it to specific users based on a User Lookup field.


Create a trigger that automatically add the User into CaseShare (Manual Sharing Rules). The solution must also cover the following scenarios:

  1. When the User Lookup field is changed from Fred to John, make sure that you will add John and remove Fred.
  2. If the User Lookup field is the same user as the Case Owner, don’t add him/her into CaseShare. You will get an error.
  3. If the User Lookup field is pointing to an Inactive User, don’t add him/her into CaseShare. You will get an error.
Related Objects Case Objects
Components Apex Trigger
Complexity Medium

Salesforce as a Subscription Billing System

Salesforce is not just a powerful CRM tool but it can be extended to meet your business requirement too. One example is to turn your Salesforce instance into a subscription billing system.

Being a subscription business model company, it is ideal to track customer information and all the subscription deals in one place. Most importantly, to have the system being able to track each billing schedule automatically without the hassle to manually create each billing item based on the subscription package the customer subscribed to.

Imagine that you will have to manually create 6 billing items for a 6 months subscription package for the hundreds or thousands of customers signed? Life would be much easier if in one place you can track your customer information and closed deals (opportunities) as well as tracking the schedule billing records, for example:-

The Subscription Product A for the customer has the following details:
Subscription Start Date: 1st Mar 2013
Subscription period: 6 months
Subscription End Date; 31st Aug 2013
Total Subscription Price: $6,000

In this case, the following billing items will automatically be created:
Billing #1 = Period: 1st Mar – 31st Mar 2013; Bill Date: 1st Apr 2013; Amount: $1,000
Billing #2 = Period: 1st Apr – 30th Apr 2013; Bill Date: 1st May 2013; Amount: $1,000
Billing #3 = Period: 1st May – 31st May 2013; Bill Date: 1st Jun 2013; Amount: $1,000
Billing #4 = Period: 1st Jun – 30th Jun 2013; Bill Date: 1st Jul 2013; Amount: $1,000
Billing #5 = Period: 1st Jul – 31st Jul 2013; Bill Date: 1st Aug 2013; Amount: $1,000
Billing #6 = Period: 1st Aug – 31st Aug 2013; Bill Date: 1st Sep 2013; Amount: $1,000

If you are interested to learn more about how you can implement your subscription model business with Salesforce, check out our recent addition of the case here and contact us for details.

Understanding Salesforce Object Relationships

There are many skill variations when it comes to Salesforce system implementation and Salesforce integration. One of it requires an understanding on the object relationship within the application. It is not hard to comprehend the relationship once you can identify the data model that you are about to build. The following are some of the common object relationships that are used to define the data model:

1. One to One
2. One to Many/Many to One
3. Many to Many

One of the ways to get yourself equipped with the knowledge is to read through the Salesforce Fundamentals documentation. Well, that’s how I got to it while undertaking the Salesforce Certification – Developer. However, if you find that going through the materials a hassle, you can always refer to the following explanation on a quick run-down on how to build the data model.

One to One object relationship

One School can only have one Headmaster

This object relationship requires that one of the associated object to be unique.
– School (Master object)
– Headmaster (Detail/Child object)
– Create a unique field in Headmaster object
– Create workflow to copy the School id to the unique field for every record creation

One to Many/Many to One object relationship

One school can have many teachers

– School object
– Teacher object: School field (Lookup to School)

When you view the relationship from School, it’s ONE School to MANY Teachers
When you view the relationship from Teacher, it’s MANY Teachers to ONE School

Many to Many object relationship

Student can enrol in many subjects

– This is where junction object comes into play for this relationship
– Student Subject (junction object)
– Subject (Master object to Student Subject)
– Student (Master object to Student Subject)

This model explains that there are many students taking up many subjects and vice versa.

Hope this clears off any confusion you have with regards to the object relationships.

Furthermore, if you plan to perform a Salesforce migration with other applications and require to figure out the object relationship via API, you can simply generate the Salesforce WSDL of your current instance via:

Setup > App Setup > Develop > API > Generate WSDL

From there, you should be able to determine the definition of the object relationship. The following extensions explain on the references:

__c – in reference to the custom field id values

__r – in reference to the custom object relationship with the current object view