Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get Text between comma seperated text field and set it on Address field.

(0) ShareShare
ReportReport
Posted on by 277

Hi Experts

I ran into this scenario today. On create of a child record, it should create a new account and assign it to child again. Here I need to get text from a multiple lines of text field(this is on child record) and update it in individual address fields of composite fields. 

The existing format is < 1234 Maple Street, Edison , NJ 12345 >

Need to get the first part of string and set it in address_street1 of composite field

city in address_city and state in address_state and same with Zip code. 

This should happen on create of a record. i tried an OOB workflow to create an account, everything works fine except for the address field as it is a Composite field. Is there a code that I could use to make it happen?

Its fine if I have to create a new account record using a plugin instead of workflow. 

Thank you

*This post is locked for comments

  • Verified answer
    Michel Gueli Profile Picture
    982 on at
    RE: Get Text between comma seperated text field and set it on Address field.

    Maybe this could help you:

    var addressList = "1234 Maple Street, Edison , NJ 12345".Split(',').ToList<string>();        

               var account = new Entity("account");

               if(addressList.Count > 0)

                   account.Attributes.Add("address1_line1", addressList[0]);

               if (addressList.Count > 1)

                   account.Attributes.Add("address1_city ", addressList[1]);

               if (addressList.Count > 2)

               {

                   var temp = addressList[2];

                   var result = temp.Split(' ').ToList<string>();

                   if(result.Count > 0)

                       account.Attributes.Add("address1_stateorprovince", result[0]);

                   if (result.Count > 1)

                       account.Attributes.Add("address1_postalcode", addressList[1]);

                   service.Create(account);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
dkrishna Profile Picture

dkrishna 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans