AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.08.2009, 18:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Afna CRM: Show custom notifications on Microsoft Dynamics CRM - upgrade
Источник: http://a-crm.blogspot.com/2009/07/sh...microsoft.html
==============

Marco Amoedo created cool javascript function that displays custom warning messages in Microsoft Dynamics CRM 4.0. http://marcoamoedo.com/blog/show-cus...-dynamics-crm/

I liked the idea so much, that I took the script and upgraded pimped it.

What it does?

The function simply adds a notification on top of the form, like in the picture below.



You can add multiple notifications with different icons.



Update or delete previously added notifications or add new ones. This image shows (after Name onChange event) changed error text, updated third notification to info style and a new warning. Compare it with previous picture.





How to use it?

Step 1: Insert this code into form OnLoad event.

/*============== addNotification function =============





Adds a message on the top of the entity form using


the same visual style as Microsoft CRM.


If function is called more than once,


the messages are added at the bottom of the list


If the message with same ID already exists,


then the message is updated and not added to a list.


It also supports deleting of previously added notifications.





Put this function in the OnLoad event,


so you can use it in all form and field events.





Parameters:


message - message to be shown to the user


messageType - Type of the message: 1 - critical, 2 - info, 3 - warning


notificationId - ID of the notification (needed for updating purposes)





Created by:


Marco Amoedo (http://marcoamoedo.com) - the idea and initial function


Dejan Dular (http://a-crm.blogspot.com) - upgraded functionality (different icons, updating and deleting notifications)





=======================================================*/


 


addNotification = function(message, messageType, notificationId)


{


var notificationsArea = document.getElementById('Notifications');





if (notificationsArea == null)


{


//Don't display message when deleting a notification.


if (messageType != 4)


{


//Sorry. Notifications are not possible on this form.


//Display a message box instead of notification.


alert(message);


}


return;


}





var notificationDIV = document.getElementById('NotificationDiv_' + notificationId);





//Delete the notification


if (messageType == 4)


{


if (notificationDIV != null)


{


//Remove the notification


notificationsArea.removeChild(notificationDIV);


}


return;


}





//Get the notification image. The default is info image.


var notificationImage;


switch (messageType)


{


case 1:


notificationImage = '/_imgs/error/notif_icn_crit16.png';


break;


case 2:


notificationImage = '/_imgs/error/notif_icn_info16.png';


break;


case 3:


notificationImage = '/_imgs/error/notif_icn_warn16.png';


break;


default:


notificationImage = '/_imgs/error/notif_icn_info16.png';


}


 


//Create notification


var notificationTable = '' + message +'';





//Check if the notification with same ID already exists


if (notificationDIV == null)


{


//Create a new notification


var notificationHTML = '' + notificationTable + '
'
;


notificationsArea.innerHTML += notificationHTML;


notificationsArea.style.display = 'block';


}


else


{


//Update the notification.


notificationDIV.innerHTML = notificationTable;


}


}


/*============= END addNotification function ===========*/



 



Step 2: Run the following function when there is a need for a notification.




addNotification(string message, int messageType, string notificationId)









Parameters:



  • message – Notification message displayed

  • messageType – Type of the notification (the icon) (1 – critical, 2 – info, 3 – warning, 4 – delete the notification)

  • notificationId – Any string that identifies specific notification. If a function is called later with existing notificationId, the notification will be updated. Otherwise a new notification is added at the bottom of the list. If you want to delete a specific notification, just set messageType = 4 and use correct notificationId.


Thanks again to Marco Amoedo.



 



Originally published by Dejan Dular




Источник: http://a-crm.blogspot.com/2009/07/sh...microsoft.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Microsoft Dynamics CRM Team Blog: CRM Online: Reporting Options Blog bot Dynamics CRM: Blogs 0 18.06.2009 06:14
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 4.0 Bookshelf Blog bot Dynamics CRM: Blogs 1 22.01.2009 04:46
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Microsoft Dynamics CRM Team Blog: Top 14 Microsoft Dynamics CRM Sites and Downloads Blog bot Dynamics CRM: Blogs 0 14.07.2008 13:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 19:52.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.