locked
Show custom Warning message! RRS feed

  • Question

  • Hello all,

    I have created  one statuscode for Contacts as "Dead" under "Active" and "InActive" status. Now if the status of the contact is set to "Dead", i need to show a Warning message just as Ms CRM shows with yello background and red text. It should be a Warning message and not the alert.

    Has anyone worked on this before using javascript or some other way?

    Please let me know if anyone have any idea on this issue.

    Thanks & Regards,
    Bhavika Patel

    Thursday, June 4, 2009 9:44 AM

Answers

  • Hi Nishant,

    I wrote a piece of JavaScript code that allows you to add warnings on an entity form in the same way as Microsoft CRM does by adding a message on the top with yellow background and red text.

    You can find more information here http://marcoamoedo.com/blog/show-custom-warning-messages-on-microsoft-dynamics-crm/ 

    Here is the code.

    /*============== addNotification function =============
    
    Adds a warning message on the top of the entity form using
    the same visual style as Microsoft CRM
    
    Params: message to be shown to the user
    =======================================================*/
    
    addNotification = function(message) {
    
        var notificationHTML = '<DIV class="Notification"><TABLE cellSpacing="0" cellPadding="0"><TBODY><TR><TD vAlign="top"><IMG class="ms-crm-Lookup-Item" alt="" src="/_imgs/error/notif_icn_crit16.png" /></TD><TD><SPAN>' + message + '</SPAN></TD></TR></TBODY></TABLE></DIV>';
    
        var notificationsArea = document.getElementById('Notifications');
    
        if (notificationsArea == null) return;
    
        notificationsArea.innerHTML += notificationHTML;
    
        notificationsArea.style.display = 'block';
    
    }
    /*============= END addNotification function ===========*/
    
    
    //Example of utilizations
    addNotification('Some warning message that you want to show to the user ');

    Hope it helps.
    Marco Amoedo - http://marcoamoedo.com
    Tuesday, June 9, 2009 1:41 PM
    Moderator

All replies

  • one possible solution could be,create your own custom dialogbox to display warning message.
    Mahain
    Thursday, June 4, 2009 10:54 AM
    Moderator
  • Hi,
    Thanks for your input. Could you please give some more information on how to create the same.
    Thanks and regards,
    Bhavika Patel.
    Tuesday, June 9, 2009 5:14 AM
  • Bhavika,

    you can create a simple aspx page with the same look and feel like crm warning message diablog box,and you can call this page using window.open and passing warning message as a parameter.

    Hope it will help!!!!!!
    Mahain
    Tuesday, June 9, 2009 5:35 AM
    Moderator
  • Hi,

    If you would like to create a dialogbox having similar look and feel as that of CRM, you could find a sample code for that in the book "programming microsoft dynamics crm 4.0".

    There is an example for that, you could download the sample code for that book from Microsoft press site and you can find the code inside "chapter 13" folder.

    Regards,
    Nishant Rana
    http://nishantrana.wordpress.com
    Tuesday, June 9, 2009 5:59 AM
  • Just to add,

    refer "crm4 ux design guide.pdf" with new sdk to implement same look and feel as of crm error dialog window.

    Mahain
    Tuesday, June 9, 2009 11:45 AM
    Moderator
  • Hi Nishant,

    I wrote a piece of JavaScript code that allows you to add warnings on an entity form in the same way as Microsoft CRM does by adding a message on the top with yellow background and red text.

    You can find more information here http://marcoamoedo.com/blog/show-custom-warning-messages-on-microsoft-dynamics-crm/ 

    Here is the code.

    /*============== addNotification function =============
    
    Adds a warning message on the top of the entity form using
    the same visual style as Microsoft CRM
    
    Params: message to be shown to the user
    =======================================================*/
    
    addNotification = function(message) {
    
        var notificationHTML = '<DIV class="Notification"><TABLE cellSpacing="0" cellPadding="0"><TBODY><TR><TD vAlign="top"><IMG class="ms-crm-Lookup-Item" alt="" src="/_imgs/error/notif_icn_crit16.png" /></TD><TD><SPAN>' + message + '</SPAN></TD></TR></TBODY></TABLE></DIV>';
    
        var notificationsArea = document.getElementById('Notifications');
    
        if (notificationsArea == null) return;
    
        notificationsArea.innerHTML += notificationHTML;
    
        notificationsArea.style.display = 'block';
    
    }
    /*============= END addNotification function ===========*/
    
    
    //Example of utilizations
    addNotification('Some warning message that you want to show to the user ');

    Hope it helps.
    Marco Amoedo - http://marcoamoedo.com
    Tuesday, June 9, 2009 1:41 PM
    Moderator