Challenge Overview
Reason for functionality:
Data is always useful. The more the better. (for the most part) Problem is when users create records, usually the minimum requirements is what is entered. They just want to get their job done, sale through etc. When possible.. supplementing some information could be very handy for reporting, tracking and quality reasons.
High Level Requirements:
- Process to supplement information from the custom object(s) or logged in user record
- Apex Code that can be re-used on a per object basis, ie: we want to be able to leverage the code for any object’s apex trigger
- Be able to activate/deactivate functionality
Details
How to supplement data
Overall requirements:
- Calculation happens on create or update when certain fields below are changed
- Only fill in fields that are entered in as blank for inserts.
- Only overwrite data when fields are changed in update.
1: Object 1
This object will hold the fields to fill in for this dependent picklist fields.
- Region (picklist)
- ex: Americas
- APAC
- Country (picklist, dependent on Region)
- ex USA
- UK
- Territory (picklist, dependent on Country)
- ex: North
- South
Insert: If they provide Territory, we can find Country & Region. If they provide Country we can provide Region.
Update: Recheck if any fields change
2: Object 2
This object holds primary language and a flag icon per Country
- Country (picklist)
- Primary Language (picklist)
- ex: English
- French
- Flag Icon (image)
- ex: American Flag.gif
- French Flag.gif
This should display as an inline visualforce page
*** We want a finite grouping of Countries with their flags.. provided at the bottom.
Insert: Only Country will be possibly provided: provide two other fields every time.
Update: Recheck if Country changes.
3: Timezone
Using Google APIs to fill in Timezone.. using Postal Code and Country Code
- Timezone (picklist)
This be a special case where we will need the google api to grab by Postal Code/Latitude/Longitude
The Google APIs give a pretty good service to accomplish this. This method would be preferred as we only have to send the request and parse the response.
Postal code Google API URL/example
http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=12205
Timezone Google API URL/example
https://maps.googleapis.com/maps/api/timezone/json?parameters=42.6446929,-73.783968×tamp=1331161200&sensor=false
We want Timezone to eventually come back in this format:
- (GMT+08:00) Singapore Standard Time (Asia/Singapore)
- (GMT+03:00) Eastern European Summer Time (Europe/Bucharest)
- (GMT-05:00) Eastern Standard Time (America/Panama)
We only want to call these APIs when we actually will be filling in the timezone, not whenT displaying. Want to avoid unnecessary API calls.
Insert: When Postal Code and Country is entered, fill in Timezone
Update: Recheck if Postal Code/Country changes.
4: Logged in User fields
After going through our config data we want to try to supplement data by using the logged in User’s data. Use this when:
- Only on insert when we try to fill in using the above rules but cannot.
- AND only on a manually created record. (so logged in user is possible)
Country picklist desired:
- USA
- Canada
- UK
- Australia
- India
Use these values for both Country fields and provide small icon flags for all five.
Mapping:
- Region
- Account.Region__c
- Lead.Region__c
- Country
- Account.Country__c
- Lead.Country__c
- Territory
- Account.Territory__c
- Lead.Territory__c
- Primary Language
- Contact.Primary_Language__c
- Lead.Language__c
- Flag Icon
- Account.Flag__c
- Lead.Flag__c
- Account.Flag__c
Final Submission Guidelines
Submission Deliverables
A complete list of deliverables can be found in the TopCoder Assembly competition Tutorial at:
http://apps.topcoder.com/wiki/display/tc/Assembly+Competition+Tutorials
- Source code and configuration files.
- Deployment guide to configure and verify the application.