Skip to Content

A CRM outsourcing services providing company hires CRM experts to bring most sophisticated solutions for the clients. While working on recent project, the Microsoft dynamics CRM online development team determined the steps to create dynamic chart on CRM page with the help of Chart.js and javascript. To learn the steps for using Chart JS and Javascript for dynamic chart development, you can read this post further.


Today, we will explain how to create dynamic chart on CRM Page using Chart.js and javascript.

To begin with, create one html page, add references for required java scripts in <head> tag like jquery.js, json2.js, sdk.rest.js, ClientGlobalContext.js.aspx and main is Chart.js for our chart control. You can get Chart.js from here and sdk.rest.js from CRM SDK. CRM already contains ClientGlobalContext.js.aspx so you have to just reference that in html page.


So, your <head> tag shows something like this.


/wp-content/uploads/2015/10/d1_713193.png

Now, we move to <script> tag, that is our java script coding part.

I wrote function to get top 50 paid records from Invoice entity. Then calculate sum of total amount of paid invoice by date. So chart will display total invoice amount per date. The following function will get Invoice records. I fetch only CreatedOn and TotalAmount, you can add more fields in select statement.


/wp-content/uploads/2015/10/d2_713194.png

You can see that from the function “GetTopInvoice”, we have called “successCallback” and “errorCallback” functions from inside. successCallback function will calculate sum of TotalAmount by date and render Chart in <div> tag. I have to write this code to calculate sum because the above CRM query does not support “Group by” and aggregate functions like sum. The successCallback function is as like this.

/wp-content/uploads/2015/10/d3_713195.png

And the errorCallback function is as like this.

/wp-content/uploads/2015/10/d4_713196.png


Your full html will display like this.

/wp-content/uploads/2015/10/d5_713197.png

After completing all the stuff on Html side, create one HTML web resource on CRM solution and copy our above HTML and script code inside it. You can load this web resource on CRM Dashboard. The result will display something like this image.


/wp-content/uploads/2015/10/d6_713198.png

You can avail MS dynamics CRM outsourcing services from Microsoft dynamics CRM online development team that works efficiently to bring robust and intuitive solutions to enhance your business growth. By following the steps shared in this post, you can learn the process of creating dynamic chart using Chart JS and Javascript. Hope we get genuine response from you!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply