2014-10-12 62 views
2

如果特定字段不爲空(更改時),我需要在實體中顯示自定義警告消息。實體形式的CRM 2013自定義通知

我在不同的公司中寫道全球JS文件,顯示消息的代碼:

addNotification: function (message) { //Adds a warning message on the top of the entity Form 

    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'; 
}, 

,並在我的實體JS文件,我寫了這個:

function checkIfAssignToIsEmpty() { 
    var AssignTo = Xrm.Page.getAttribute('el_assign_to').getValue(); 

    if (AssignTo != null) 
     newNotification(); 
} 

function newNotification() { 
    var assignToVal = Xrm.Page.getAttribute("el_assign_to").getValue(); 
    var newNotification = GlobalFunction.addNotification('assiignToVal + The Task will assign to'); 
} 

我收到錯誤消息後,我選擇我的領域的價值

對象不支持屬性或方法'addNotification'

你能幫忙嗎?

回答