function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BdoggBdogg 

Create a formula that trims 50 characters and ends with ...

Hi I am trying to create a formula that will take the first 60 characters from a field and add ... to the end of the formula, however if the field is blank it would remain blank.

 

I've figured out the trim, I just can't figure out the "..." part. 

 

TRIM(LEFT(ECS__Shipping_Detail__r.ECS__Shipping_Instructions__c,60))

 

I appreciate the help.

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
Shannon HaleShannon Hale

I think you probably want to do something like this:

 

IF(
  LEN( ECS__Shipping_Detail__r.ECS__Shipping_Instructions__c ) <=60,          /* Line 1 */
  ECS__Shipping_Detail__r.ECS__Shipping_Instructions__c,                      /* Line 2 */
  LEFT( ECS__Shipping_Detail__r.ECS__Shipping_Instructions__c, 60 ) & "..."   /* Line 3 */
)

 

Line 1: Condition to check whether the field length is less than or equal to 60 characters.

Line 2: The field length is less than 60 characters, so return the field content as is -- which means blank if the field is blank.
Line 3: The field length is more than 60 characters, so return the first 60 characters and append "..."