How to use Salesforce Long Text Area fields in formulas?

12:05 PM

Note:I tried this only with the LEN function and i hope it works with other formula functions as well.

My requirement:

I wanted to calculate the length of a couple of fields of data type Text Area, and put the number into a new field.

As usual, i created a formula field and used the LEN function. When i tried to INSERT my Long Text Area fields, they were not available for selection. I later found out that you cannot use Long Text Area fields in formulas as of now. Hope that it becomes available soon, until then here is a workaround.

Let's say that i have an object named "MyCustomObject__c". I want to calculate the sum of the length of the Long Text Area fields Field1__c, Field2__c, Field3__c and put the value into SumofLenght__c

STEP 1: Create a new field on the object MyCustomObject__c named "SumofLength__c" of datatype "Number".

STEP 2: Create a new Workflow rule on the object "MyCustomObject__c"

Evaluation Criteria: Every time a record is created or edited
Rule Criteria: MyCustomOject Name: NOT equal to NULL


STEP 3:

Create a Workflow Field Update as below


4 comments

  1. hi im need to help how i can validate the inputbox in visualforce salesforce

    ReplyDelete
  2. If it's an inputfield you can just use validation rules, else you can validate the ipuutbox in your apex class using the getter and setter methods

    ReplyDelete
  3. Great solution! I thought I was going to have to write a trigger for this! Thanks so much!!

    ReplyDelete