Wednesday, 25 November 2015

Copying multiple related records into a single text field

Copying multiple related records into a single text field

I was recently working with a customer who had an object with multiple records related to it.

They wished to copy all of the text from all child records and populate a single text box with the combined results.

The related call notes linked to the Task record

Thursday, 19 November 2015

Simple solutions first - Test Class on User object

Test Class

Do you really need to create that new user in your Apex Test class?

This is just a short blog post on an "ah ha" moment I had the other day whilst coding.

After I had nearly finished creating lines of code to create a few user records in the Test Class I realised that I could have just used a $User global variable instead.

Friday, 13 November 2015

Task Due Date populating

Pre-Populate the Due Date field in Salefsorce Task Object

I was recently working with a customer who wanted to automatically the ActivityDate or Due Date field on the Task Object automatically.

Unfortunately, at this moment in time (Winter '16) you cannot access the ActivityDate or "Due Date" via Formula or Workflow so this solution required an Apex Trigger.

Sunday, 8 November 2015

Data Nirvana: phone number accuracy in Salesforce

How accurate are your Account & Contact phone numbers in Salesforce?

Thanks to everyone who voted on my poll relating to this new app idea. In this post I wanted to share a bit more background on where the idea for the app came from.

If you haven't yet voted, here's a quick link to the post.

Vote on new AppExchange idea - automatic phone cleansing/validation app

Vote on new Salesforce App idea



How useful would a Phone Number cleaning/validating app for Salesforce be to you? For more information about the new app, click here. Thank you for voting!

Monday, 2 November 2015

SOQL with Child Records - a loop within a loop

SOQL and Child Records

A lot of posts regarding Apex coding focus on reducing down the number of SOQL statements you make during a Trigger.

One way to achieve this which is recommended by David Liu on his blog is to:
  1. query all possible records
  2. build up a map to store all the query results
  3. when looping through the Trigger records, query against the map rather than the database each time
  4. perform a single update at the end of the Trigger - no matter how many records you are working with