Friday, 18 December 2015

UserRecordAccess - Check what level of access a user has to a record

Confirming Record Access Level

There are many considerations for User and Record security in Salefsorce. You have to set your Organisation Wide Defaults, Sharing Rules, Profile Access, and Field Level Security.

With all of these settings, it can get be quite complex to debug a user access issue.

I believe that every Salefsorce Administrator has at some point heard from a user who cannot see a particular record (you won't very often hear from users who can access things that they shouldn't).

I recently discovered a way to help with security questions like these. Salesforce allows you to query against any user's ID and any specified record and get a concrete Yes/No response on whether the user in question has Read/Write access to it.

Sunday, 13 December 2015

Report on Activities by Historic Opportunity Stage

Report on Activities by Opportunity Stage

One regularly asked question that I've seen on the Salesforce Success Community and other Salesforce forums is: 
"How do I report on activities made at different stages of the Sales process?"
You would be forgiven for thinking that there was a simple out of the box report that would show this. However, the standard Activity reports in Salesforce all have a look up to the Object they are reporting on. That means that as the Opportunity object progresses through the sales stages, so does the reference on the Activity.

For example - 

  1. on the 1st April I made a call whilst Opportunity was in "Discovery"
  2. on the 2nd April I made another call whilst the Opportunity was "Closed Won"
A standard Opportunity with Activity report in Salesforce will show you 2 Activities related to an Opportunity with "Closed Won" as the status for BOTH activities.

So, how do you solve this?


Sunday, 6 December 2015

Apex lastindexOf string manipulation

Apex String Manipulation

Apex has several powerful String manipulation features.

You can search for values in Strings, replace matching words, count matching string entries, capitalise letters, remove spaces, and much much more.

There's a good overview of all of the String manipulation methods available here: Apex String methods on Developer Force

On this particular occasion I needed to find the last instance of a few matching characters in a long text field and populate a new field with its value.