Friday, April 25, 2014

Salesforce: An Alternative to the Banner Visual Force Page

From time to time, there is a requirement to display a warning or a soft error on a Salesforce detail page that will alert the user before an action takes place.  For example, warn the user to complete certain fields before converting a lead.  This allows the user to save a lead with minimal information, but add to it over time until he can convert it.

One way to do this is to create a custom Visual Force page that displays as a banner on top of the detail page.  This page can be controlled by an APEX class that performs all the validations and displays a text depending on the information already on the lead.  It could say "Postal Code is required before converting this Lead."  And that message can be in red, and in a box.  It's great because you can control the look through coding.  The downside is, it's coding.

An old alternative was to use a standard Text field with IMAGE functions, displaying a red flag, yellow flag, or green flag, and an appropriate message.  This link details that solution.  This is a good no-coding solution. However, the text is just as big as regular fields, and can be missed.



If they miss this message, it is frustrating to the user, especially if it is preventing him from submitting for approval, and the only available message is the standard message that it does not meet any approval entry criteria.



It is very cryptic.

Some time in 2010, Salesforce released a new data type, Rich Text Area.  And instead of using a regular field for a warning message, this data type can be used.

First, create the field with an appropriate length, say 1024.  It should be read only to everyone, so that only workflow field updates will populate it.  Then add it to the top of the page layout in its own section.  The section heading can be removed, which is what I recommend so that it behaves like a visual force banner.






The field label cannot be hidden, so label it appropriately, like "Messages".

And now, you can use standard Workflow that fires appropriately based on certain criteria, and put a message in.  For example, if Country is US, CA, UK, and Postal Code is NULL, you can set the Messages field to something like:

"<p><strong><big><span style=\"font-size:26px;\"><span style=\"color:#ff0000;\">Postal Code is required for this country before converting.</span></span></big></strong></p>"


The above formula will be shown on the page like this:



This allows a user to still save the record, and he can come back and add the postal code later.  A little bit of HTML knowledge can come in handy here, but there are a handful of HTML generators online for those unfamiliar.  They may insert unnecessary tags, so the administrator may need to experiment and test to see what looks best.

Always keep in mind that there are limits on the number of workflows and limits on the formula editor.  This is where an admin can get creative to work around these limits.


Monday, April 14, 2014

Salesforce Gotcha! Time-Based Workflow Nuance

I received a complaint that a certain time-based workflow was not firing consistently. I looked at the workflow in question.  This was created by one of the Salesforce Certified consultants earlier on. In summary, it works like this:

Workflow A: evaluated when record is created, or edited and subsequently meets criteria
Condition: Status is X
Immediate Action: Set a Future Fire Date to Today() + 240
Time-Based Action: Send email 1 hour after Future Fire Date

On the surface, this sounds logical.  It even works from time to time.  I checked all records with Status X and they all are in the time-based workflow queue.  But thinking about previous implementations, we know that Salesforce does not guarantee order of execution of workflow actions. So it is possible that the time-based action is being put into the queue, but the Future Fire Date is still blank, in which case, it will not be added to the queue.

I searched the Knowledge Base for more information.  The Time-Based Workflow FAQ did not have definite information about it.  I ended up opening a case with Salesforce Premiere Support.  They confirmed that the above workflow will NOT consistently work.

This is why the Field Update has a new feature to trigger workflow rules after the update.

The correct solution then is to break the workflow above into two:

Workflow A: same as above
Condition: Same as above
Immediate Action: Set a Future Fire Date to Today() + 240
Check the flag on the Field Update to Trigger Workflows

Workflow B: evaluated when record is created, or edited and subsequently meets criteria
Condition: Future Fire Date is not null  (or Status is X)
Time-Based Action: Send Email 1 hour after Future Fire Date

This will now work consistently and no records will be missed.

Friday, April 4, 2014

Salesforce: Completing The Picture

For a sales rep or a manager to have a complete picture, he needs to see the total value of his closed business together with his open opportunities.  It easily tells him how much he's won, and how much is coming in the future.  The third component of this is of course his target.  These three make it easier for him to manage his business or his team.  In this article, we will focus on presenting "won business" to the sales team.

In Salesforce, if all the opportunities are managed by a sales rep, all of them would be in Salesforce.  So a view into closed business would be as simple as a report of all won opportunities.  As a company grows, this may not always be the case.

There could be incoming business that are sold completely through a different channel, like partners or online direct sales.  There could also be run-rate business, incoming orders that are zero to low touch, recurring or non-recurring orders for spare parts, automatically renewing subscriptions, and similar instances that the sales rep does not actively manage.

And that is where the challenge begins.  How do you complete the picture for your sales team to include this type of business?  There are several options to explore:

The first one is relatively simple in Salesforce, but requires manual entry.  Have some data administrators create won opportunities for the bulk of these no-touch closed business, one for each rep or territory.  If you use Opportunity Products, create one line for each product you report on.  They may also create an open opportunity to show future run rate amount.

The advantage of using Opportunities is that all the existing Opportunity-based reports will work with these records.  The standard Forecast module will also work.  The disadvantage of this particular option is the manual intervention required.  The more sales reps there are, the more opportunities need to be maintained.  The more products you have, the more lines need to be maintained.

The next step to this option is to attempt to automate this via a data feed.  A daily or weekly feed from a data store or directly from your order management application can be used to update these same opportunities.

This gives you the advantages of automation, i.e. not needing admins.  It does require building this automation to transform the data into something that the Opportunity object will accept.

Another option is to use a custom Orders object, or use the new standard Order object that came with the Spring '14 release.  This moves you more into standard Salesforce functionality, but still requires either manual data entry or automated data feeds.  For most companies, the order management application is not Salesforce, so building some form of integration is a must.

The other matter to consider is how much of order details do you really need?  Do you copy each and every order individually and all the line items?  Consider that Salesforce has limits on data storage, which is a function of the number of users in your organization.  Also consider how much reporting are you planning to have in Salesforce?  If you have a product hierarchy, and most reports just filter or group by product family, then you don't need SKU level line items.

So far all of these options involve just Salesforce and some integration.  This is fine if your technology strategy is "Salesforce first".  And for a large part of your sales team, this will suffice.

The final option is of course, one that is more sophisticated.  With all the advantages of Salesforce reports & dashboards, being very easy to create and maintain, Salesforce is still not an analytics platform.  Each company will have to evaluate for themselves whether that simplicity is a priority over capabilities that true analytics and business intelligence solutions provide.

This solution will combine all your data, from campaigns, leads to opportunities, to quotes to orders, even to commissions, into a single data store where everyone can run simple reports to the most sophisticated dashboards that combine all these. There are several choices in this space.  A quick Google search will yield new companies as well as established players.

Having a single solution for both sales, operations and back office may make sense for some organizations.  One requirement though would be seamless integration with Salesforce, both from a data perspective and a user experience perspective.  Sales users should not feel that they are jumping into another application.

The advantage of this option is that you get all the capabilities of a true analytics tool.  The disadvantage of course is the expense of the tool and all the integration work required.

Some companies may be better off with a mix of both: a true business intelligence tool AND reports & dashboards in Salesforce.

In summary, there is no one-size-fits all solution.  Each company must decide and balance their priorities, their capabilities and their budgets, and find one that fits them.