Posts

Showing posts from February, 2021

DYNAMICS 365 HOW TO ADD AND USE NAMESPACE IN JAVASCRIPT

Image
In this previous post, we have learned how to create, structure and organize the Dynamics 365 Web Resources files . In this post, we will learn how to add and use namespace in Dynamics 365 JavaScript web resource and how to call the functions. In the JavaScript web resource, add your specific namespace as per the below code var CAKBlog = CAKBlog || {}; //Create CAKBlog namespace CAKBlog.Form = CAKBlog.Form || {}; //Create CAKBlog.Form namespace CAKBlog.Form.Account = function () { //Create CAKBlog.Form.Account namespace //Functions are added here }(); Add your functions' logic inside, noting that these functions are private and cannot be directly called CAKBlog.Fo...

DYNAMICS 365 HOW TO FIX SECTION OVERLAPPING OTHER SECTION IN FORM

PROBLEM Last day, I was working with D365 V9 on-premise and I have encountered a weird issue where a section was overlapping on another section side by side. It was very strange since all the fields in this section are having the same behavior. The special thing about this section is, that it contains many html web resources and other fields that are being hidden using JavaScript, and the issue occurs in the edit form. When the web resources are displayed on the create form, the issue is not there and everything seems normal. REASON After some digging in the html to see what might be the issue, I noticed that the section (table in the generated html) with the erroneous behavior has a style table-layout : auto, if I set it to fixed (in the developer tool - F12), the section is normally displayed and the overlapping is gone even when I resize the window. However, this soluti...

DYNAMICS 365 HOW TO USE FORM CONTEXT IN HTML WEB RESOURCE

Everyone knows that Xrm.Page is deprecated and it is replaced by the executionContext.getFormContext() method, where the execution context is passed from the form as the first parameter to the function you are calling (reference link ). In the same above link, it is mentioned that Although Xrm.Page is deprecated, parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource . However, you can access the form context from HTML web resource without using Parent.Xrm.Page and this is the topic for today. You have to create a function that will return the formContext , then, on load of the form call this function, and finally call this function from the web resource. Declaration of a variable and function that return the formCont...