Monday, January 24, 2011

How to override "Log a Call" - the easy way

"Log a Call" is a standard button you'd see on the "Activity History" related list on any enabled Salesforce.com object page layout.  Since it's "Log a Call", the subject is naturally set as "Call".  We often get asked if we can put in things like "Phone - Outbound", because when it comes to wording certain things, some business people tend to be quite specific. Well, it's a simple request without a straightforward answer.  I've seen people overriding the standard button with a VF page that redirects.  I'd like to not code if I can, even though coding very much pays my bills.  :)  My solution is to use a custom button on Task, List Button type, labeled "Log a Call", shown in the same window without bars, and just a plain adapted URL from the standard button with merge fields, such as:
/00T/e?title=Phone%20-%20Outbound&who_id={!Contact.Id}&followup=1&tsk5=Phone%20-%20Outbound&retURL=%2F{!Contact.Id}
Depending on where it's invoked and what the Subject it needs to have, you can just tweak the parameters and the merge fields.  Nice and simple, even an admin can do it.

Tuesday, January 4, 2011

Apex Class Security: Subtlety

The "Enabled Apex Class Access" section on a Salesforce.com Profile seems to be straightforward.  You can limit whether the profile has access to the methods on Apex classes.  Recently I discovered it's not that simple. 

I had a profile that had nothing enabled under Apex Class.  So you'd think those users don't get to invoke things on those classes.  Not so.  They would be able to start the VF pages, which displayed just fine.  So at least many getters on the controller classes ran just fine.  However action methods would fail silently.  You can invoke, but nothing comes back (in my case it's outbound calls).  Even more intriguing thing is, if you enable debugging on the user, the whole thing would start working magically.  And it would stay that way even after the debugging is turned off.

Once I had all classes enabled for the profile, this behavior disappeared.  I'd love to do some controlled experiment on that but didn't have time.  Just wondering if anyone noted similar issue...