Dynamics 365/CRM JavaScript Reference

 In Blog

Dynamics 365/CRM has come a long way since the 4.0 and 2011 days when JavaScript was the only way to meet most custom requirements. We now have business rules, roll-up fields, calculated fields, process flows and more that can be configured to meet custom requirements right within the GUI (which is the recommended path when you can get away with it). But for the times when you can’t get what you need from the front end, here’s a quick D365/CRM JavaScript reference to help with syntax in your custom form scripts:

TOC:

Getting and setting field values:

Get the value of a Text field
Set the value of a Text field
Get the text of a Lookup field
Set the value and text of a Lookup field
Get the value of a Numeric field
Set the value of a Numeric field
Get the value of a Bit field
Set the value of a Bit field
Get the text of an Option Set
Get the value of an Option Set
Set the text and value of an Option Set
Get the value of a Date field (01/31/2018 or 31/01/2018)

Customizing forms:

Show/hide form sections
Show/hide form fields
Set requirement level
Use the value of an Option Set to set up form


Getting and setting field values:

Get the value of a Text field

Set the value of a Text field

Get the text of a Lookup field

Set the value and text of a Lookup field

Get the value of a Numeric field

Set the value of a Numeric field

Get the value of a Bit field

Set the value of a Bit field

Get the text of an Option Set

Get the value of an Option Set

Set the text and value of an Option Set

Get the value of a Date field (01/31/2018 or 31/01/2018)

Customizing forms:

Note: Much of this functionality can be handled with Business Rules in D365/CRM. Please consider using them before creating this functionality with form scripts.

Show/hide form sections

Show/hide form fields

Set requirement level

Use the value of an Option Set to set up form

One of the best things about being a D365/CRM developer is the community of world class developers that share their knowledge and tirelessly help other CRM developers solve problems and improve their skills. Many thanks to the community and CRM MVPs that have made this post possible.

Need help with a customization? Send us an email to info@dynamicconsulting.com with a brief description of what you’re trying to accomplish and one of our Solution Architects will get in touch to help out.

*NOTE: These code snippets are for reference use only; there is no guarantee they will work in your D365/CRM environment.

Showing 2 comments
  • David Withers
    Reply

    Why are you using XRM…….. 🙁

    • Charlie Fink
      Reply

      @David – I assume you’re referring to the deprecation of Xrm.Page. We’re working on an updated post using the latest methods, stay tuned!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Contact Us

Have a question? Want more information? Let us know!

Not readable? Change text. captcha txt