top of page
Search

SIMPLIFYING DYNAMICS 365 DEVELOPMENT: ADDING A COMMON FUNCTION IN A JS WEB RESOURCE




In the world of enterprise resource planning (ERP) and customer relationship management (CRM) systems, Dynamics 365 stands as a powerful and versatile solution provided by Microsoft. With its extensive customization capabilities, Dynamics 365 empowers organizations to tailor their business processes and workflows to their specific needs.

One key aspect of customization in Dynamics 365 is the ability to extend the functionality of the system using JavaScript web resources. These resources enable developers to augment the user interface and implement custom logic to enhance the overall user experience.


In this article, we will explore the process of adding a common function to a JavaScript web resource in Dynamics 365. By incorporating a common function, developers can leverage its functionality across multiple forms, views, or even modules within the system. This approach not only promotes code reusability but also ensures consistency and simplifies maintenance efforts.


Throughout this guide, we will delve into the steps required to create a JavaScript web resource, define a common function within it, and seamlessly integrate it into Dynamics 365. Whether you are a seasoned developer or just beginning your journey with Dynamics 365 customization, this article will equip you with the knowledge and skills needed to streamline your development process.


By adopting this best practice of incorporating a common function in a JavaScript web resource, you can harness the full potential of Dynamics 365 to meet your organization's unique requirements. So let's dive in and discover how to optimize your development workflow and unlock new possibilities in Dynamics 365 customization



Step 1: First write a module and function for the common function.



Let assume you want to use func1 in another function in another file/module.

Step 2: Next you have to create the Common file with above code.




Step 3: Then you have to write the actual function and use that func1 to your code.



Let us assume that you want to use that func1 function in func2 function in Code Module.


Step 4: Now create this Code module as a js file in your solution.


Step 5: Now lets say you want to use this func2 in a Entity ‘CustomEntity’ on save of Main form.

So you have to add that func2 as a ‘OnSave’ Event in that ‘Main form’.


Step 6: After adding that file in form library, you have to add that Common file in the same form also.




NOTE: Always remember that you have to add that Common file in the form in ‘FORM LIBRARY’ where you are using that Common Module. Or else you will get an error like – “The ‘Common’ Module is not defined”.


In conclusion, adding a common function to a JavaScript web resource in Dynamics 365 is a valuable technique for simplifying development and maximizing the potential of the system. By incorporating this best practice, developers can promote code reusability, ensure consistency, and streamline maintenance efforts. This article has provided a comprehensive guide on creating a JavaScript web resource, defining a common function, and seamlessly integrating it into Dynamics 365. Whether you're an experienced developer or new to Dynamics 365 customization, implementing this approach will enhance your development workflow and enable you to unlock new possibilities in customizing Dynamics 365 to meet your organization's unique needs.




For further queries or demos please comment below or contact us.





For any consultant/support work on O365/ development, contact us or visit our website www.sigilotech.com

26 views0 comments

Comments


bottom of page