Programming Assignment Scenario - ABC Real Estate
Programming Assignment Scenario - ABC Real Estate
Salesforce
Certification
Programming
Assignment
Winter
’16
1
Salesforce
Certification
Programming
Assignment
Contents
PROGRAMMING
ASSIGNMENT
INSTRUCTIONS
..................................................................................................
3
SALESFORCE
ORGANIZATION
SPECIFICATIONS
.....................................................................................................
3
HOW
TO
SUBMIT
YOUR
PROGRAMMING
ASSIGNMENT
..................................................................................
3
SCORING
.......................................................................................................................................................................
4
GENERAL
REQUIREMENTS
........................................................................................................................................
4
COMPANY
OVERVIEW
...............................................................................................................................................
5
PROJECT
OVERVIEW
...................................................................................................................................................
5
DATA
MODEL
OVERVIEW
..........................................................................................................................................
5
ACCESS
AND
PERMISSIONS
OVERVIEW
.................................................................................................................
9
LOGIC
REQUIREMENTS
............................................................................................................................................
10
USER
INTERFACE
REQUIREMENTS
.........................................................................................................................
11
TESTING
REQUIREMENTS
........................................................................................................................................
17
! An Enterprise Edition organization with 20 active licenses, 5 of which are reserved for judges. Do not
activate the judge users or use them for any other purpose.
! Develop the application in a Force.com sandbox and deploy to the production organization provided.
! In the production organization, locate the user named Certification Administrator, activate and
update the user’s email address to [email protected], ensuring that the Generate new
password and notify user immediately checkbox is checked.
Once submitted, the application is considered to be final. Salesforce will receive login credentials for the
user, enabling the Certification Administrator to access the organization. Upon confirmation of the
Certification Administrator user activation, Salesforce will deactivate the candidate’s user.
For questions related to the submission process, open a case with the Certification team:
http://certification.salesforce.com/open-a-case.
Please note: All assignments must be received and short essay exams completed by Wednesday,
December 30 at 9:00 a.m. Pacific Time (GMT -8:00) (US and Canada). No exceptions will be made.
Scoring
Once a candidate’s Programming Assignment and essay exam have been received, the work submitted will
be reviewed and scored by a panel of qualified Salesforce experts.
Each candidate will be evaluated on the decisions made when designing the programmatic elements of the
application, which include:
General
Requirements
Each candidate is expected to comply with the following general requirements for application development:
! The application must be the original work of the candidate. Candidates may explore best practices and
patterns found in online resources, but may not include code copied directly from other sources,
including public libraries.
! All application development must be done in a sandbox environment and fully deployed to and tested
in the production environment.
! Each candidate will need to create his or her own sample data set to support application development
and manual testing in both the sandbox and production organizations.
! The application must scale for large data and user volumes, as stated in the requirements within this
document. However, it is not necessary to load the data volumes stated; a sample data set is sufficient.
! The application must handle programmatic exceptions gracefully. Any end-user errors or exceptions
should be presented in a user-friendly format.
! The user interface must be functional and meet the stated requirements, but time should not be spent
creating an elaborate user interface as aesthetics will not be evaluated. The user interface should match
the flow and structure of the wireframes provided.
! Comments within code are highly recommended, as they may be useful to help judges better
understand the function of the code developed during the evaluation process.
! Do not include any personally identifiable data in the organization or code comments, with the
exception of your email address on user records.
! All requirements must be addressed in the final application submitted for evaluation and scoring. No
extra credit is given for going beyond the identified requirements.
Company
Overview
ABC Real Estate (ABC) is an up-and-coming real estate firm. The company was started by three original
agents (Arnold, Betty, and Charlie) but has now expanded to dozens of full-time agents in several regional
offices.
The agents working for ABC are paid a commission earned on the buying and selling of properties.
Tracking the amount of commission earned by each agent has been a completely manual process, and has
become increasingly difficult as the company expands.
Project
Overview
ABC continues to grow, but the original IT infrastructure has not scaled to meet the demands of the
expanding company. In a recent decision, the founders of the company chose the Force.com platform to
bring its business into the cloud.
The process to review closed sales and calculate agents’ commission splits has become a lengthy and time-
consuming task. ABC would like the system to automate the calculation and tracking of agent
commissions. A Salesforce Certified Platform App Builder has built their data and security model. Now,
ABC Real Estate requires a Salesforce Certified Advanced Developer or a Salesforce Certified Platform
Developer II to build their update logic and custom user interfaces.
This document outlines the current state of the application and the remaining requirements the candidate
will need to fulfill. It should be assumed by the candidate that no significant declarative configuration
changes are necessary to fulfill the requirements; only code development and very minimal configuration
of a mechanism to invoke the code will be required.
Data
Requirements
User
Currently, all Agents are full Salesforce Users. In the future, ABC will create a Salesforce Community.
When that happens, Agents will be transitioned away from full Salesforce Users. For this project, an Agent
will have both a Contact record and a User record. All DML should be performed on the Agent’s
Contact record.
! Agent User: Salesforce User record for this agent. Lookup field (User).
Note: The ABC Salesforce Administrator has made this a required field on the Contact page layout.
! Account: The Salesforce account (e.g., “ABC Real Estate”) to which the Contact is associated.
Note: The ABC Salesforce Administrator has made this a required field on the Contact page layout.
! Sales Office: Sales Office where this agent works. Lookup field (Sales_Office__c).
Note: The ABC Salesforce Administrator has made this a required field on the Contact page layout.
! Year to Date Total Commissions: The total amount of commissions earned by this Agent during the
current year. Currency field.
! Year to Date Total Sales: The total amount of sales closed by the Agent during the current year.
Currency field.
! Default Commission Split: The default commission percentage earned by the Agent each time a
Property is closed. Default value is 40%. Percentage field.
! Agent Commission Amount: Holds the amount of commission to be paid to the agent. NOTE: This
cannot be a formula, since the flat commission rate (currently 3%) can change, and would therefore
affect previously closed Properties. Currency field.
! Agent Commission Percentage: The percentage of the total commission received by the agent. When
an agent first claims a property, this should equal the percentage in the Default Commission Split on
the agent’s Contact record. Percentage field.
NOTE: ABC Real Estate plans future enhancements involving commission percentages, and has
expressed concerns about Order of Operation conflicts with planned custom code. For this reason, do
not populate Agent Commission Percentage via Workflow.
! Sale Date: The date the property was closed. Date field.
NOTE: The ABC Salesforce Administrator has created a workflow rule to populate the Sale Date (if
blank) when a property has closed.
! Sales Price: The actual sales price of the property. Currency field.
NOTE: The ABC Salesforce Administrator has configured a Workflow rule to populate the Sales Price
(if blank) with the Listing Price when a property has closed.
! Sales Office: Sales Office that handles this Property. Lookup field (Sales_Office__c).
! Year to Date Sales: The total amount of sales by agents assigned to this sales office during the current
year. Currency field.
! Sales Region: Sales Region to which this office is assigned. The sales office is a child record in a
Master/Detail relationship to Sales Region. Master/Detail field (Sales_Region__c).
! Regional Manager: Salesforce User who runs an office. Lookup field (User).
Data
Volumes
The application must scale to handle the following data volumes:
! Agents: Hundreds
Application
Users
There are two primary user groups for the application:
Agents are Real Estate Agents who work with clients to buy and sell properties. They are paid a percentage
of the commission earned on properties. The remainder of the commission is kept by the sales office.
Sales Managers are ABC employees who manage a sales region. They review all closed properties and
perform a final approval of the commission split.
Profiles
Profiles with the appropriate visibility and CRUD (create, read, update, delete) settings have already been
configured in the Salesforce organization provided.
Candidates should not need to modify profiles except to add/remove Visualforce Page and/or Apex Class
access as the candidate deems necessary.
Logic
Requirements
This section of the document details the automation that the candidate is required to implement
programmatically.
Approving Commissions
After an agent has sold the property and marked Property__c.Status__c as “Closed Pending Approval,” a
sales manager must review the property, optionally increase the commission percentage, and approve the
commission split for the agent. A property is considered approved when Property__c.Status__c is changed
to “Closed Approved.”
When approved, Property__c.Agent_Commission_Amount__c should be computed. Then
Property__c.Agent_Commission_Amount__c should then be added to
Contact.Year_to_Date_Total_Commissions__c on the agent’s Contact record.
NOTE: ABC currently charges their clients a flat 3% agency commission for all properties sold, but this
percentage may change in the future. The amount of commission earned by an agent would be the product
of multiplying Property__c.Sales_Price__c by the agency commission rate (3%), and then multiplying that
by Property__c.Agent_Commission_Percentage__c. Example:
! Agency Commission: 3%
! This would yield $1,200 in commission for the Agent (100000 * .03 * .40).
Figure 1
As shown in Figure 1, the candidate must create a custom button on the Sales Office Page called “Claim
Properties.” This will launch the custom User Interface to claim properties by the agent.
Figure 2
As shown in Figure 2, when the page first loads, all Open properties should be displayed for the agent’s
sales office.
1) The name of the Sales Office should be displayed.
2) Only properties with a status of “Open” that are assigned to the agent’s sales office and NOT
claimed by an agent should be displayed.
3) Properties are sorted by Property Street.
4) The Properties should appear 5 rows at a time, and should display the current page number, the
total number of pages, and provide links to the first, last, next, and previous pages. Pagination
buttons/links should only appear if relevant (ex: “First” and “Previous” links should be omitted or
disabled from the first page of results).
5) Contact.Year_to_Date_Total_Sales__c and Contact.Year_to_Date_Total_Commissions__c should
be displayed.
Figure 3
As shown in Figure 3, an agent can claim multiple properties at a time.
1) The agent should be able to select records on multiple pages, and have all records across all pages
saved at one time when either the “Claim Properties” or “Claim and Continue” buttons are clicked.
No changes should be committed when paginating.
2) Only selected rows will be saved.
3) The numbers for Properties Claimed, Contact.Year_to_Date_Total_Sales__c, and
Contact.Year_to_Date_Total_Commissions__c should always reflect the most current data saved
in the database.
4) As the agent selects properties, a counter should display the number of properties currently
selected across all pages.
5) Any time a property is claimed by clicking the “Claim Properties” or “Claim and Continue”
buttons:
a. Property__c.Status__c should be updated to “Working.”
b. Property__c.Agent__c field should be updated with the current user’s Agent (Contact)
record.
c. Property__c.Agent_Commission_Percentage__c should be updated with the default
percentage from the agent’s Contact record.
d. The numbers for Contact.Year_to_Date_Total_Sales__c and
Contact.Year_to_Date_Total_Commissions__c should be computed.
e. The numbers for Sales_Office__c.Year_to_Date_Sales__c should be computed.
6) If the agent clicks “Claim Properties,” the screen should return to the Sales Office.
7) If the agent clicks “Claim and Continue,” the screen should remain on the Claim Property screen
and the most current numbers should be displayed for Number of Properties Claimed, My Year to
Date Sales, and My Year to Date Commissions.
8) No changes should be committed to the database if the total number of claimed properties is
greater than 5 (number of previously claimed properties + number of selected properties to be
claimed). An error message on the screen should notify the agent if this happens.
9) If an error prevents a successful save, including current validation rules, future validation rules,
and unexpected Apex exceptions, all committed changes should be rolled back.
10) Clicking the “Cancel” button will return to the Sales Office page, and will not commit changes to
the database.
Approving
Commissions
ABC would like Sales Managers to have the ability to quickly approve multiple commissions. Sales
managers need a screen that will allow them access to all open properties for their assigned sales region.
They should be able to select multiple properties at a time, and mark all selected as being “approved.”
Sales managers should be able to increase the commission split for selected properties from this screen (the
commission may be increased as a performance incentive, to reward agents for repeat customers).
Managers should also be able to cancel out of the page. Agents should not be allowed to approve
commissions via this screen.
Figure 5
As shown in Figure 5, the candidate must create a custom button on the Sales Region Page called
“Approve Commissions.” This will launch the custom User Interface to approve the commission amount
and override the default commission. A Sales Manager should only be able to view properties for his or her
region.
Figure 6
As show in Figure 6, when the page first loads, all properties that are “Closed Pending Approval” for the
sales region are displayed.
1) The name of the Sales Region should be displayed.
2) Only properties with a status of “Closed Pending Approval” and in the currently selected sales
region should be displayed.
3) Properties are sorted by Property__c.Sales_Office__c and then by Property__c.Agent__c.
4) The Agent Commission Percentage is populated with the value from the Property record.
5) The properties should appear 5 rows at a time, and should display the current page number, the
total number of pages, and provide links to the first, last, next, and previous pages. Pagination
buttons/links should only appear if relevant (ex: “First” and “Previous” links should be omitted or
disabled from the first page of results).
6) The numbers for Sales_Office__c.Year_to_Date_Sales__c should be displayed and should always
reflect the most current data saved in the database.
Figure 7
As shown in Figure 7, a sales manager may select individual rows to approve.
1) The manager should be able to select records on multiple pages, and have all records across all
pages saved at one time when either the “Approve Commissions” or “Approve Commissions and
Continue” buttons are clicked. No changes should be committed when paginating.
2) For any selected row, the sales manager may override the default Agent Commission Percentage.
3) Only selected rows will be saved.
4) The manager may check the “Select All” checkbox to select every row on the current page.
5) When the manager clicks “Approve Commissions” or “Approve Commissions and Continue,” for
each selected property:
a. Property__c.Status__c will be updated to “Closed Approved.”
b. Property__c.Agent_Commission_Percentage__c will be saved. If the manager overrides
this field, the new value will be saved.
c. Property__c.Agent_Commission_Amount__c will be calculated on the property.
d. Contact.Year_to_Date_Total_Commissions__c will be computed on the agent’s Contact
record.
6) If the manager clicks “Approve Commissions,” the screen should return to the Sales Region.
7) If the manager clicks “Approve Commissions and Continue,” the screen should remain on the
Approve Commissions screen and the most current numbers should be displayed for Total Year to
Date Sales. The previously approved properties should not appear on the page.
8) If an error prevents a successful save, including current validation rules, future validation rules,
and unexpected Apex exceptions, all changes should be rolled back.
9) Clicking the “Cancel” button will return to the Sales Region page, and will not commit changes to
the database.
Testing Requirements
Apex
Tests
The candidate is responsible for writing Apex tests to validate the application behavior against business
requirements. The tests should assert that the automated logic and user interface function correctly, validate
application security, and ensure that the application scales for large data volumes. The application must
meet the code coverage requirements for deployment into a full production organization. Apex tests should
be written to be data- and organization-independent.