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
ekorzekorz 

handling carraige returns in a formula field (i.e. split BillingStreet into two fields)

Howdy,

 

I'm passing data from one system to another, and Salesforce keeps Account.BillingStreet as one field, whereas my external system likes "address1" and "address2" separately (and treats a carrage return as invalid) .  I was hoping to solve the problem by buildng two formula fields, one for "address line 1" and another for "the rest of BillingStreet". 

 

The delimiting factor would seems to be a carraige return stored in BillingStreet, and although I can find that it's "char(10)" in excel and should be '\r' otherwise, I can't figure out how to program these formula fields:

 

ex. formula field 1 - find the first carraige return, if any, and return everything to the left

  LEFT( BillingStreet , FIND('\r', BillingStreet)-1)    -- but this doesn't work

 

formula field 2 - find the first carraige return, if any, and return everything to the right

 

 

 

Or if there's a better way...

 

Help!

Best Answer chosen by Admin (Salesforce Developers) 
Satish_SFDCSatish_SFDC
Well, i tried with \n , \r\n , BR() , but could not get the expected results.
Someone also suggested \\n but even that did not help.

A quick search in google gave me the link to an idea in the ideas exchange.
Although not the same, this idea is similar.
https://success.salesforce.com/ideaView?id=08730000000BqBQ

Looking at the idea, i can assume that there is no default functionality to find the line breaks in text fields.

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.

All Answers

Satish_SFDCSatish_SFDC
Well, i tried with \n , \r\n , BR() , but could not get the expected results.
Someone also suggested \\n but even that did not help.

A quick search in google gave me the link to an idea in the ideas exchange.
Although not the same, this idea is similar.
https://success.salesforce.com/ideaView?id=08730000000BqBQ

Looking at the idea, i can assume that there is no default functionality to find the line breaks in text fields.

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
This was selected as the best answer
ekorzekorz

Looks like I'll just create a validation rule preventing folks from adding carraige returns, and update all my existing data.  Workaround, boo.