Dynamics 365/CRM JavaScript Reference
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
View the code on Gist.
Set the value of a Text field
View the code on Gist.
Get the text of a Lookup field
View the code on Gist.
Set the value and text of a Lookup field
View the code on Gist.
Get the value of a Numeric field
View the code on Gist.
Set the value of a Numeric field
View the code on Gist.
Get the value of a Bit field
View the code on Gist.
Set the value of a Bit field
View the code on Gist.
Get the text of an Option Set
View the code on Gist.
Get the value of an Option Set
View the code on Gist.
Set the text and value of an Option Set
View the code on Gist.
Get the value of a Date field (01/31/2018 or 31/01/2018)
View the code on Gist.
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
View the code on Gist.
Show/hide form fields
View the code on Gist.
Set requirement level
View the code on Gist.
Use the value of an Option Set to set up form
View the code on Gist.
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.
*These code snippets are for reference use only, and while supported, there is no guarantee they will work in your D365/CRM environment. If you have questions about how to use these, please leave a comment below or contact us.
The post Dynamics 365/CRM JavaScript Reference appeared first on Dynamic Consulting.

Like
Report
*This post is locked for comments