Hello everyone.. I am having a few issues by using setFormNotification in Dynamics CRM 2013 (on premise)
I want a form notification with 1 single notification (warning) but it's a 4 line text
now the issues:
- I am trying to insert a string with "newline" in the setFormNotification but it's not working (I tried "\r\n", "\n", "<br></br>", even String.fromCharCode(10) but none of them I got it working.
- so my first try was creating 4 notifications.. but.. I want only 1 icon and not 4 (as it is actually only 1 notification and not 4), so I tried creating by using the type "INFORMATION" or simply ""
After doing this what happened was that the 1st notification (which had the icon) was always going to the last line, which is totally not what want
- so I let all notifications and tried to remove the icon via javascript
here is the code
ShowNotification = function () {
if (mycondition...) {
Xrm.Page.ui.setFormNotification("4th line notitication", "WARNING", "notification04");
Xrm.Page.ui.setFormNotification("3rd line notitication", "WARNING", "notification03");
Xrm.Page.ui.setFormNotification("2nd line notitication", "WARNING", "notification02");
Xrm.Page.ui.setFormNotification("1st line notification", "WARNING", "notification01");
document.getElementById('Notification1').childNodes[0].childNodes[0].childNodes[0].childNodes[0].setAttribute('style', 'visibility:hidden');
document.getElementById('Notification2').childNodes[0].childNodes[0].childNodes[0].childNodes[0].setAttribute('style', 'visibility:hidden');
document.getElementById('Notification3').childNodes[0].childNodes[0].childNodes[0].childNodes[0].setAttribute('style', 'visibility:hidden');
}
else {
Xrm.Page.ui.clearFormNotification("notification01");
Xrm.Page.ui.clearFormNotification("notification02");
Xrm.Page.ui.clearFormNotification("notification03");
Xrm.Page.ui.clearFormNotification("notification04");
}
}
- this almost worked for me, this function is being called both on the events ONLOAD and ONSAVE of the form, and after the ONLOAD event it's working fine but after ONSAVE it works and after it finishes saving the form it's doing kind of a rollback only for the changes I made with document.getElementById..... in other words, the icons are coming back to the notifications
- I also tried another thing, which was instead of creating 4 notifications, I created only the 1st and append the text in the 1st notification.. but the result was the same .. after saving it disappears my changes, in this case it disappears the 3 next lines of notification.. here the code for this one
ShowNotification = function () {
if (mycondition...) {
Xrm.Page.ui.setFormNotification("1st line notitication", "WARNING", "notification01");
document.getElementById('Notification0_text').appendChild(document.createElement("br"));
document.getElementById('Notification0_text').innerHTML += "2nd line notitication";
document.getElementById('Notification0_text').appendChild(document.createElement("br"));
document.getElementById('Notification0_text').innerHTML += "3rd line notitication";
document.getElementById('Notification0_text').appendChild(document.createElement("br"));
document.getElementById('Notification0_text').innerHTML += "4th line notitication";
}
else {
Xrm.Page.ui.clearFormNotification("notification01");
}
}
does anyone has any ideas?
I am doing this notification in a custom entity (6 entities actually and all the same result)
I am testing in both IE 11 and Chrome
thanks in advance