Activity Forums Salesforce® Discussions How to split Address in Salesforce?

  • Manpreet

    Member
    January 18, 2018 at 5:10 am

    Hi Bhanu,
    You can use a specific identifier to split the custom address field into address components and store in proper address fields.You should determine the identifier in your custom address field. Usually the identifier will be Comma(,).

    Custom Address Field value = 45, CLARENCE ST, SYDNEY, NSW 2000

    In your apex method,

    List<String> lstofAddress = object.customField__c.split(',');
    object.AddressField1 = lstStringAddress[0];
    object.AddressField2 = lstStringAddress[1];
    object.AddressField3 = lstStringAddress[2];
    object.AddressField4 = lstStringAddress[3];
    object.AddressField5 = lstStringAddress[4];

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos