Stat Tracker

Thursday, October 20, 2011

Salesforce Mobile - Formula Fields with Line Breaks Work Around

If you are an admin for Salesforce Mobile you are probably familiar with how easy it is to get setup and running for simple out of the box implementations. However, you might see issues with line breaks in formula fields. Let me explain:

Formula Fields are rendered at the Salesforce Server for Salesforce Mobile and pushed down. So when you have Formula Field which is a text field with line breaks (BR() Function) the field won't look correct in Salesforce Mobile. Instead of seeing a line break like this:
In Salesforce Mobile you will see

This was giving me quite a headache. Here is the simplest solution I could find.

1. Create a new TextArea field in Salesforce to replace your existing Formula Field.

2. Create a Workflow Rule on the Object. Have the Workflow rule execute every time a record is updated or created. Make sure the formula always evaluates to true.

3. Create a new Workflow Field update for the new TextArea field from step 1. Copy your existing Formula Field's Formula into the new value for the Field.

4. Activate the Workflow.

That's it. Now the formula will be evaluated and stored in Salesforce as a String. It will now be displayed properly in both Salesforce and Salesforce Mobile.

It's too bad it doesn't render properly in Mobile out of the box, but this is a liveable work around.

If anyone has a better solution please share!