• Home
  • Microsoft Dynamics CRM
  • Office 365
  • Services
  • Contact Us
  • Blog
NetriSoft
Call Today:  (810) 299-2259

Adding Buttons to a CRM From using Jquery 

6/25/2012

0 Comments

 
6/25/2012 UPDATE:  This new version will work in either Header, Footer, Body or all!

In the post we are going to take a look at licking a problem that I have with Microsoft Dynamics CRM 2011. That is adding buttons to a form to perform some sort of action. There are several ways of firing script such as onchange of fields or even adding buttons to the ribbon bar. The ribbon bar is pretty interesting way of adding functionality, if you have the time download the definitions, find the exact spot and order you want your button, then finally re-import it. Its a cool feature and these new buttons are available for all forms for the entity, but it is overkill for simple things.  This post will show you how to quickly add buttons to a page with just a few lines of javascript.
  1. This plugin requires Jquery, download the latest version and add it along with the CRMButtonBar plugin to the script collection for your form.
  2. Create a new attribute (a text field is fine) and add the new attribute to the form where you want the buttons to show up.
  3. Either add the following code to your main Javascript page or or create a new script page.
 1   $(document).ready(function(){
2 $('#new_newname_d').CrmButtonBar ({
3 sourcefield: 'new_newname',
4 buttons:[
5 {
6 text : "Press Me",
7 click: function (){alert("Button 1 Pressed");},
8 width : '50px'
9 },
10 {
11 text : "Press Me Too!",
12 click: function (){alert("Button 2 Pressed");},
13 width : '150px'
14 }]
15 });
16 });
When you’re done, your page should look similar like the following:
Picture
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Brian Greig

    Archives

    August 2013
    December 2012
    October 2012
    September 2012
    June 2012
    April 2011
    January 2011

    Categories

    All
    CRM
    CRM 4
    CRM For Outlook
    CRM Online
    CRM On-Premise
    Expanding CRM UI
    JavaScript

    RSS Feed

NetriSoft, LLC
8702 N. Second Street
Brighton, MI  48116
Phone:  (810) 299-2259
Fax:  (810) 299-2766
Email: [email protected]
Picture
©2015 Netrisoft, LLC. All rights reserved.  Please read our Privacy Policy and Terms of Use
Site design by
Second Son Solutions