web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

calculated field to generate user initials

(0) ShareShare
ReportReport
Posted on by 365

When we create orders in CRM, they are sent over to GP. When they go over to GP they are printed as invoices and we need to know who to hand them to. I would like the initials of the user who created the order to be sent over.

I would therefore like a calculated field on an order entity that takes the created by field and turns "John Smith" into "JS" and "Adam Jones" into AJ etc. I can then use these initials in my mapping over to GP. Taking the full name uses too many characters in GP hence my need for just initials.

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Wayne Walton Profile Picture
    13,730 on at

    How are you handling collisions?  Such as, if you have Wayne Walton and Will Wheaton in the CRM system, having both of them listed as WW would be an issue.

    My suggestion would be to update the User record with an Initials area and manually choose everyone's initials.  Then update your GP integration to look up the Initials field instead of the full name field.

  • Suggested answer
    Abed Haniyah Profile Picture
    4,287 on at

    You can use normal text field instead of calculated field, then by using javascript code you fill it by first letter of each word in a string ( Use Full Name):

    First you need to get the value of created by:

    var createdby    =Xrm.Page.getAttribute("createdby").getValue();

    Then you can get the first letter of each word in a string by :

    var matches = createdby.match(/\b(\w)/g);

    var initial = matches.join('');  

    Then set the field value by :

    Xrm.Page.getAttribute("new_field").setValue(initial);

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans