Challenge Overview
Mary Scotton (the #awesome Developer Evangelist for salesforce.com) is writing a blog post for developer.force.com and wants our help with the Apex code and algorithm. She is going to talk about crowdsourcing the application so this is a great chance to get your name up in lights. Here is her blog post announcing this challenge.
She is developing a “Mother-Son Bowling Day” application in Force.com to facilitate the assignment of family members to bowling lanes based upon a number of factors. The goal of the challenge is to finish the application and write the Apex to match people with the people they want to bowl with AND to organize the lanes by grade. Here is a sample scenario: at some point in time during the registration for bowlers, Mary will want to assign all of the bowlers (perhaps 100 or so?) to lanes. She'll need to be able to easily run a batch process (or something similar which is essentially your matching algorithm) to assign bowlers to langes when people they want to bowl with and also by grade. Perhap sometime after she has assigned all bowlers, x number of bowlers will sign up again and she'll want to run the job to assign these new bowlers.
Mary has already defined the data model and you can install it via this unmanaged package. Here’s a quick overview:
She has prefixed the custom fields, layouts, object, and record types with MSB (Mother Son Bowling) so they are easier to find. Also, to make the app easier to use, map your Profile to the new Contact, Account, and Campaign Member Page Layouts, and map the Campaign Record Types to their Page Layouts (Bowling Application -> MSB Application Layout; Event -> MSB Campaign Layout).
Using mostly standard objects, centering on Campaigns. There is a Parent Campaign (Record Type = Event) for the event "Mother Son Bowling 2014", and then use child Campaign records of Record Type = Bowling Application for each application. Campaign has a lookup to Account, which is how you relate the Application to a Household. Campaign Members are the Contacts from that household.
Group Me With custom object is a junction of Account (Household) and Campaign (of Record Type "Application") that captures which families someone lists on their application.
The Lane is a custom picklist on Campaign (showing up only on the page layout mapped to Record Type = Application), and this ensures that all of the people from that application (the people in the household/account) bowl together - that's important!
Number of Members is a custom rollup summary field on Campaign (showing up only on the page layout mapped to Record Type = Application) that counts the Campaign Members (i.e., the # of people in that family/household who are bowling).
Grade is a custom picklist on Contact. Also added a Spanning Formula of type Text on Campaign Member to display Grade.
Set the Lane value for each Campaign of Record Type "Bowling Application" and Status = "Registered" and Parent Campaign = "Mother-Son Bowling 2014" (extra credit if this is somehow dynamic so that in 2015 we can run the same code for a different parent campaign).
Mothers fill out the following application form. All of the data on the form maps to the data model: account -> household, contact -> mom, contact -> son, etc. Also, many
families do not request other families to bowl with.
- Each form has at least 2 people from the family on it, but could have more. All of those people have to bowl in the same lane. Notes: Most common family size is 2. 10% of families have a size of 3.
- Each form has space to list any number of other families you want to bowl with. We want these families to bowl in the same lane as the application family, when possible, so that everyone is happy. Notes: sometimes a family that is requested never sends in their own application; sometimes family A asks for family B, but family B does not ask for A. Maybe family B asks for family C.
Other business requirements:
- There are 30 bowling lanes.
- Each lane can hold 8 people comfortably but 9 is allowed.
- This is a fundraiser, so she wants to fit as many people as possible (i.e., want all lanes to be full).
- Goal is to match people with the people they want to bowl with AND to organize the lanes by grade, from K-4 (e.g., Kindergarteners in Lane 1, 2, 3; 1st graders in Lane 4, 5, 6, etc., however the distribution works out best - might be 3 lanes for a class, might be 4 or 5).
Final Submission Guidelines
Install this unmanaged package which contains all of the code and config you need to get started. Please submit any setup instruction and/or modifications that you made. Must have 75%+ test coverage (as usual). Upload all of your code as a ZIP file or include the URL to an unmanaged package. A video oveview of the application and how it works is also required. Perhaps the video will be made part of Mary's blog?