Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Concatenating a field without special characters

Posted on by Microsoft Employee

I'm struggling to find a solution to CONCATENATE two fields, a date & time field and a text field, but I want to eliminate the special characters such as / and :

For example:

Field1 = ABCD

Field2 = 10/04/2016 01:29 PM

I can combined these fields as "ABCD10/04/2016 01:29 PM", however my goal is to get "ABCD100420160129PM"

Any suggestions would be great. 

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Concatenating a field without special characters

    hi,

    You can trigger js on change of both fields,

    To concat follow the link: businesswithcrm.wordpress.com/.../concatenation-of-two-crm-fields-using-j-script

    To remove special character using regular expression please find the link:

    ciappara.com/.../remove-special-characters-like-from-string-javascript

    www.alex-arriaga.com/remove-special-characters-using-a-regex-in-javascript

    rajeevpentyala.com/.../regular-expression

  • Suggested answer
    ansrikanth Profile Picture
    ansrikanth 3,115 on at
    RE: Concatenating a field without special characters

    Where you want to get this string ?? in Javascript (so that you can place in another field) or in Plugin ? Either way, you should be able to use a simple RegEx to replace all these special chars.

    A regular expression some thing like "[;\\/:*?\"<>|&'_+-]" should do the trick for you. Use it and replace the matches with String.Empty or "".

    Regards

    Srikanth

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans