Mar 14, 2016

Lab Coat Challenge 7: Merge Text

Salesforce Devs, we have a Lab Coat Challenge for you that will test your mental ability. Review the challenge, take a look at the starter code, and then give it your best attempt. If you come up with the right answer, you will earn a Lab Coat Badge. We'll share your success on Twitter!


Today’s challenge has to do with merging text.


Hi {!FirstName},

We hope you enjoy {!Number__c}.  Show us your {!ChallengeSkillset__c} chops!

Hang on..., that’s not a typo or a merge fail. It’s the gist of this Lab Coat Challenge. You’re developing a way to construct a dynamic query that includes all of the placeholders in a given piece of text. Your objective is to take in a string of text, with one or more merge fields, pluck out the fields, and build your query string out.

For example, for the above sample, your query string would need to pull in the FirstName field (IE:  SELECT Id, FirstName, ChallengeNumber__c, ChallengeSkillset__c…).

Starter Code

You must use the following code and can only add to the code provided below.