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)

New to Dynamics CRM 2015 -- Copying simple text to whole number field

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm new to Dynamics CRM 2015, and was hoping for a point in the right direction.

My requirement is to obtain a value from an entity's text field that is of a specific format -- then parse and strip out the numbers, and set the value in a whole number field.

ex: Text field with value: I-2032-22. On record create, set another whole number field with value 203222. My research points me to creating a new custom action step, however, I'm wondering if there is a simpler method to accomplish this? Leveraging calculated field functionality would be ideal, but it doesn't seem to support converting data types. Any help is appreciated, thanks!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mamatha Swamy Profile Picture
    5,426 on at

    Hi,

    AFAIK, calculated fields cannot be used for this purpose. You could use JScript (form/UI based record creation only) or plugin to fill in the other field.

    Refer

    blog.webfortis.com/ms-crm-2011-field-formatting-and-regular-expression-objects-with-javascript-7june12

    msdn.microsoft.com/.../gg594416.aspx

    msdn.microsoft.com/.../gg328490.aspx

  • Verified answer
    Mithilesh Kumar Profile Picture
    10,047 on at

    Hi Shin,

    You cannot use Calculated Fields for this purpose. You need to build a Custom JScript which will run on the OnChange event of the Text Field.

    As you said that the Format is fixed, you can try below simple function for the above Format

    //Format (<Alphabet>-<Number>-<Number>)

    function getNumberFromString(context){
     var fieldObj = context.getEventSource();
     if (fieldObj != null){
      var fieldValStr = fieldObj.getValue();
      var fieldValArr = fieldValStr.split("-");
      val fieldValNumber = fieldValArr[1] + fieldValArr[2];
      alert(fieldValNumber);  
     }
    }

    Use this function on the OnChange event of the Text field and make sure to pass the execution context.

    Hope that helps

    Thanks

  • Community Member Profile Picture
    on at

    Thank you both for your answers. I think a plugin would best serve my specific purpose, so I have chosen that route. Will keep custom JScript in mind for future requirements as well!

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