Tuesday, June 19, 2012

Jquery Mobile Dialog when ajax is disabled

Click Here:

Normally, dialog boxes in JQM do not require full HTML pages, just HTML snippets (e.g. :layout => nil) as they are loaded via AJAX and work like jQuery UI dialogs.

However, when you set "$.mobile.ajaxEnabled = false" JQM will no longer load dialogs via ajax, EVEN if you set "data-ajax=true" on the dialog links. That seems like a bug to me, ignoring "data-ajax=true". A patch to fix the problem:
diff --git js/jquery.mobile.navigation.js js/jquery.mobile.navigation.js
index f85a491..181b9c9 100755
--- js/jquery.mobile.navigation.js
+++ js/jquery.mobile.navigation.js
@@ -1322,10 +1322,11 @@
                        var baseUrl = getClosestBaseUrl( $link ),
 
                                //get href, if defined, otherwise default to empty hash
-                               href = path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl );
+                               href = path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl ),
+        isTargetDialog = $link.data("rel") === "dialog";
 
                        //if ajax is disabled, exit early
-                       if( !$.mobile.ajaxEnabled && !path.isEmbeddedPage( href ) ){
+                       if( !$.mobile.ajaxEnabled && !isTargetDialog && !path.isEmbeddedPage( href ) ){
                                httpCleanup();
                                //use default click handling
                                return;

Monday, May 28, 2012

CRM Fetch XML Execute Tool

This tool is developed to execute custom fetch xml to get the results from the connected crm environment
please feel free to post your suggestions to improve this tool

you can find the source code and the executable from the below link.

https://crm2011fetchexecute.codeplex.com/

Tuesday, April 24, 2012

Using JQuery and Json in Ribbon button’s function handler(Include JS files in Ribbon Button Script)


  • In one of my CRM 2011 requirement, I had to update a record using ribbon button placed on CRM grid.
  • I had written an update script which calls OData service using Json & JQuery. (link)
  • But when I execute the function, I got “$ undefined” exception.
  • I wondered since I already had “Json.js” & “JQuery.js” web resources added to my entity.
  • After digging deeper, I came to know that, “JQuery.js” web resource is not getting loaded when my ribbon button’s function handler fired.
Fix :-
  • I fixed the problem by loading “JQuery.js” web resource dynamically, before I call my update method.
  • Below is the script to load the web resource’s


 var JScriptWebResourceUrl = “../WebResources/new_JQuery”;
var xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
xmlHttp.open(“GET”, JScriptWebResourceUrl, false);
xmlHttp.send();
eval(xmlHttp.responseText);

Saturday, April 21, 2012

CRM 2011 Add notifications to entity form


CRM 2011: Notification area


function DC_Notification() {
    var attributes = Xrm.Page.data.entity.attributes;
    
    var notificationsArea = document.getElementById('crmNotifications');
    /*clear out notification area*/
    notificationsArea.SetNotifications(null, null);

    if (notificationsArea == null)
    {
        alert('div not found');
        return;
    }
    /*
    The integer is the notification type
    1 = Error
    2 = Warning
    3 = Info
    notificationsArea.AddNotification("<;unique value>;", 3, "","Your text here");
    */
    /*Create some notifications*/
    notificationsArea.AddNotification("1", 1, "1","Test 1");
    notificationsArea.AddNotification("2", 2, "2","Test 2");
    notificationsArea.AddNotification("3", 3, "3","Test 3");
}