Form notification with timeout in CRM 2013

Form and field notification are new to CRM 2013 and there have already been quite a few posts about these. I was playing around with form notification and wanted to display an Info notification that would automatically go away after a few seconds. This is a common nice to have for informational messages.

This actually was pretty simple to achieve using the standard setTimeout function. Below is the generic script for achieving this.

var BNH = BNH || {};
BNH.FormNotification = (function() {
	return {
		setAutoRemovedNotification: function (message, id, displayDurationSeconds) {
			Xrm.Page.ui.setFormNotification(message, 'INFO', id);

			setTimeout(function () {
			}, displayDurationSeconds * 1000);

Invoke this with the code below.

BNH.FormNotification.setAutoRemovedNotification('Hello world!', 'MY_MESSAGE', 5);

The only minor issue is that by default the notification is displayed inline with the form. Form content is therefore pushed down when the notification appears, and moved up when it is removed – which may slightly disrupt the user. It’d be nice to apply some CSS to float the notification on top of the form content.


About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in CRM. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s