Coding

Published on December 30th, 2016 | by Guest

1

Understanding Events & Validations in Editable grids of CRM 2016/Dynamics 365

In this article,  will  use of Events and Validations in Editable grids applied in CRM dynamics 365 project for CRM Application development. As Grid itself is editable, developers need to take care of all validations of form attributes on grid. This blog explains the concept and use of Events and validations in detail.

In Microsoft Dynamics CRM 2016 update and Dynamics 365, editable grids support client side scripting such as events and methods similar to read only grids. Since grid itself is editable, all validations of form attributes must be taken care on grid as well. Hence these editable grid events are very important for adding the validations. As of now, editable grid supports OnChange, OnRecordSelect, OnSave events. OnChange is fired when one of the attribute data is changed from editable grid. OnRecordSelect is fired when the user selects a record in the grid.

This article assumes you have awareness about editable grids. If you are new to creating editable grids, look at this article https://blogs.technet.microsoft.com/lystavlen/2016/10/30/editable-grids-is-here/

Let us take a simple phone number validation on Account entity. A JS web resource need to created and referenced as shown below from grid events.

For this example, we are adding validation during “OnChange” event of grid attribute Main Phone(telephone1). Also, make sure that Main phone attribute is there in the view. Adding event handlers here are similar to form event handlers.

Xrm.Page.getControl("crmGrid").getGrid()  can be used to retrieve grid object. Grid object contains selected rows and its data. Add below code to web resource that shows how to retrieve a specific attribute value.

(For more info on API methods, visit https://msdn.microsoft.com/en-us/library/mt788311.aspx )

Similarly OnSave event can be utilized for adding validations on the editable grid.

Updating Values in Grid

Based on the validations, if you might want to update values of the grid, then SetValue()  method can be used.

accountsGrid.getSelectedRows().get(0).getData().getEntity().getAttributes().get("telephone1").setValue("somevalue");

Similarly to change required level status…

accountsGrid.getSelectedRows().get(0).getData().getEntity().getAttributes().get("telephone1").setRequired Level("required");

The code and content shared by CRM application development team is solely for reference purpose. If you have any problem while using the code or reading the points shared in this post, ask professionals in comments.

Like this post? Share with your friends.
Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Share on Reddit
Reddit
0Share on Tumblr
Tumblr
0Share on VK
VK
Email this to someone
email

Tags: , , , , , ,


About the Author

Guest

Contribution of guest authors towards Techno FAQ blog



One Response to Understanding Events & Validations in Editable grids of CRM 2016/Dynamics 365

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Back to Top ↑
    • Browse by category

    • Start reading

      • Things That You Need To Know About The Online Gaming WorldThings That You Need To Know About The Online Gaming World
        At some point of time in our life everyone would …
      • Mobile Website Features That Consumers Anticipate In Their MindMobile Website Features That Consumers Anticipate In Their Mind
        In the recent time, we have observed that the mobile technology is pouring onto the market as mobile marketing has emerged the most successful platform for companies to expand their business globally. To get targeted visitors and attract as many customers as possible, it becomes imperative for businesses to have a user-friendly website that is fully optimized for mobile. At the time of developing a mobile website, you think of typography and decide not to experiment with font colors and types. You also think of content and choose it cautiously that would engage and entertain visitors. Even, you also predict your visitor’s clicking trail in order to make it easier for them to reach their desired place. In short, you are trying to make your mobile website user-friendly, but have you ever considered what mobile consumers really expect from your website? Do you know what features they want to see in your mobile site? Below, we have outlined top mobile website features that consumers are anticipating in their mind: Simple Access to Contact Forms As a professional website owner, you probably know that it is not only important that you serve your visitors with clear information about your business and services, but you also offer them with an easy way to contact you. It will be a great idea to add a contact form to your site; however, you make sure to add contact form that is easy to customize to match your requirements and suit your website design. Moreover, don’t forget to create a simple path for your users to contact you as it will have more success if your users will be capable of clicking directly on your contact form. In the case of long and tricky forms, the users will have to scroll more and it would be inconvenient for them. Easy to Navigate Website When it comes to navigation, it plays a very important role to make your mobile website user-friendly.  Easy navigation is as important as the loading speed of your website, so make sure that mobile users should be able to perform the important actions from the level of the main page and reach the vital content from every single page. …
      • Shape Your Network Traffic and Speed Up the Flow: MPLS Can Help You Streamline Your ApplicationsShape Your Network Traffic and Speed Up the Flow: MPLS Can Help You Streamline Your Applications
        What is MPLS? Multiprotocol label switching is the easy answer. …
      • Top 5 Furniture App for Buying FurnitureTop 5 Furniture App for Buying Furniture
        Advancements in technology have made sure that instead of going …
      • George Brown College – An OverviewGeorge Brown College – An Overview
        About the University Situated right at the heart of Toronto, …
    • Advertisement

    • Recent comments

    • Subscribe to updates

      You can get the latest posts from Techno FAQ delivered to you via Email or RSS.

      Enter your email address:

    • Subscribe to our RSS feed
    • Advertisement

    • Find us on Facebook

    • Latest tweets

    • Advertisement