Dynamics 365 Customer Engagement Deep Dive: Creating a Basic Jscript Form Function
This is an accompanying blog post to my YouTube video Dynamics 365 Customer Engagement Deep Dive: Creating a Basic Jscript Form Function, the first in a series that aims to provide tutorials on how to accomplish developer focused tasks within Dynamics 365 Customer Engagement. You can watch the video in full below:
Below you will find links to access some of the resources discussed as part of the video and to further reading topics.
PowerPoint Presentation (click here to download)
Full Code Sample
function changeAddressLabels() {
//Get the control for the composite address field and then set the label to the correct, Anglicised form. Each line requires the current control name for 'getControl' and then the updated label name for 'setLabel'
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_line1").setLabel("Address 1");
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_line2").setLabel("Address 2");
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_line3").setLabel("Address 3");
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_city").setLabel("Town");
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_stateorprovince").setLabel("County");
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_postalcode").setLabel("Postal Code");
Xrm.Page.getControl("address1_composite_compositionLinkControl_address1_country").setLabel("Country");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_line1"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_line1").setLabel("Address 1");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_line2"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_line2").setLabel("Address 2");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_line3"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_line3").setLabel("Address 3");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_city"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_city").setLabel("Town");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_stateorprovince"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_stateorprovince").setLabel("County");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_postalcode"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_postalcode").setLabel("Postal Code");
if (Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_country"))
Xrm.Page.getControl("address2_composite_compositionLinkControl_address2_country").setLabel("Country");
}
Download/Resource Links
Visual Studio 2017 Community Edition
Setup a free 30 day trial of Dynamics 365 Customer Engagement
W3 Schools JavaScript Tutorials
Source Code Management Solutions
- Visual Studio Team Services – Free for up to 5 users and my recommended choice when working with Dynamics 365 Customer Engagement
- BitBucket
- GitHub
Further Reading
MSDN – Use JavaScript with Microsoft Dynamics 365
MSDN – Use the Xrm.Page. object model
MSDN – Xrm.Page.ui control object
MSDN – Overview of Web Resources
Debugging custom JavaScript code in CRM using browser developer tools (steps are for Dynamics CRM 2016, but still apply for Dynamics 365 Customer Engagement)

Like
Report
*This post is locked for comments