Pages

Monday, February 13, 2012

There's a Hole in My Bucket!

Ah, for many Salesforce users, Spring '12 was rolled out over the weekend. There are lots of new features that I've been chewing on in the pre-release sandbox and a few surprises.

One of the new features is the ability to create report "Buckets." Buckets let you create groups for a field's data without needing to create a formula field. I can't tell you how many formula fields I've created just to display the information I want to see on a report correctly. Of course - these bucket fields exist only on the report you're creating, so if you want to base workflow off of the field, it is off to the formula field editor for you.

Say you've got your list of clients, all equally important to you (of course), but you'd like to group them by the amount of assets they've brought to you. I'm not saying my Gold level clients are going to receive any special treatment over the Bronze level - I just want to know... really.

I'm going to classify my clients, using three tiers:
Gold: Anyone over 3,000,000
Silver: Between 1,000,000 and 3,000,000
Bronze: Below 1,000,000

1)  To create a new Bucket field, within a new/existing report, click on the "Add Bucket" link within the fields section.



2)  Next, double-check your "Source Column, give your Bucket field a name, and define your ranges:

3)  Click on the "OK" button and you'll see your newly created "Service Level" field within your report grid:


 
Unfortunately, like many initial rollouts of SF (I'm looking at you lookup field filters), it is lacking the ability to create and use filters.

What if I had a client that has been with me from day one.  Sounds like an instant Gold Service Level criterion to me.  It would be great to be able to include something like "Initial Contract Date < 1/1/2005" = Gold, else follow the ranged criteria.

For more information, check out this video, by my new favorite SF video narrator:  http://www.youtube.com/watch?v=QFYEtBtLHG4

Saturday, February 11, 2012

Don't Double Quote Me!

I came across an odd bug within a Visualforce page yesterday.  At least I think it is a bug - I can't explain it and it has been esclated to an upper tier of premier support.

Within an <apex:outputPanel />, I was using a "rendered" formula within the tag:

<apex:outputPanel rendered="{!If(AND(myObject__c.relatedObject__r.theSuspectField__c = 'The Picklist Value',myObject__c.myField2 > 0), true,false)}">


Ater I saved the page (and although the page would save), I started to receive warnings that I needed to close my tag. Thinking that was strange, I commented out everything between my and tags and received the same thing. Then I saw my rendered formula - that's strange, I must have used double quotes by accident. This is what I saw:

<apex:outputPanel rendered="{!If(AND(myObject__c.relatedObject__r.theSuspectField__c = "The Picklist Value",myObject__c.myField2 > 0), true,false)}">


I replaced the double quotes with single ticks again, hit save, and bam - they were converted to doubles again.

What gives?

Eventually I figured out that if I changed the order in which my fields were listed, the record would save as expected - no double quotes:

<apex:outputPanel rendered="{!If(AND(myObject__c.myField2 > 0,myObject__c.relatedObject__r.theSuspectField__c = 'The Picklist Value'), true,false)}">


I'm assuming that this it has something to do with myObject__c.relatedObject__r.theSuspectField__c being a picklist field, located on a related record.  Why it works in an alternate position in the formula, beats me, but is probably one of those strang quirks of Salesforce.

I'll update as I find out more.

Note:  I was using the inline VF editor, but saw the same issue when I attempted to resolve the issue within the Force.com/Eclipse IDE.