Design a site like this with
Get started

Difference Between SetNotification and SetFormNotification

Ever found a form with only a notification and you struggled for hours to find where that field is ? #Dont_be_a_karan

In todays short article we will walk through two Javascript Functions that are used to set functions and compare the UI

SetFormNotification :

This function creates a notification however the limitation is that there is no control on the Notification, essentially that means the user is forced to find where she/he is going wrong , now this would be great if you have a small form with lets say a single tab but this isn’t ideal if you have a form with 5 tabs..

The syntax goes as – formContext.ui.setFormNotification(errorMessagePast, “ERROR”, notificationId);

And to remove this notification the syntax goes as – formContext.ui.clearFormNotification(notificationId);

Set Notification :

This is very similar to the Set form Notification however the key difference lies in the ability for the user to navigate to the problematic field. Additionally the Set notification property cannot be used to set up recommendations (INFO) or warnings.

The syntax goes as –  formContext.getControl(“args”).setNotification(errormessage,notificationId);

And to remove this notification the syntax goes as –  formContext.getControl(“args”).clearNotification(notificationId);

Comparing the UI of the two notifications –

If you look closely you will notice that the Set notification error highlights the field that has an error as well as the notification near the ribbon gives you the ability to navigate to the correct field where as the Set form notification error just gives you an error on the form.

Sample code – ( pre-requisite to create two fields named Set notification and Set form notification )

function sfn(executionContext) {
    var formContext = executionContext.getFormContext();
    var errorMessagePast =  "Form notification";
    var errorMessagePast1 =  "set notification";
    var y = formContext.getAttribute("kkit_setnotification");
    var notificationId1 = "_myUniqueId1";
    var x= formContext.getAttribute("kkit_setformnotification");
    var notificationId = "_myUniqueId";

        if(x.getValue()==null || y.getValue()==null)
            if(x.getValue()==null && y.getValue()==null )
        formContext.ui.setFormNotification(errorMessagePast, "ERROR", notificationId);
            if (x.getValue()!=null && y.getValue()==null )
            if( x.getValue()==null && y.getValue()!=null)
                formContext.ui.setformNotification(errorMessagePast, "ERROR" ,notificationId);



I hope this helps 😀 !


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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: