CRM development company experts explain the use of Form and Field notifications in this blog. We will also discuss about Add Notification use, which is introduced by Dynamics 365 December update.
Dynamics CRM 2013 has brought Form and Field Notifications which are very handy to show custom messages on CRM forms. In addition to that, Dynamics 365 December Update has introduced a new notification function called identification to show notifications on the forms by client side scripts.
How is addNotification is different from already existing method setNotification?
addNotification allows you to embed an action to run based on user input. It means that you can show either an error message or info message with buttons such as Apply and Dismiss, based on user selection, an action can be fired.
To understand the functionality, let us take an example.
On Account form, shipping method dropdown contains values such as Airborne, DHL, FedEx etc. If user selects DHL as method of shipping for the customer, freight terms (another dropwon on account form) must be set to FOB. This is simple example of OnChange event functionality. With, addNotification method, we can improve user experience.
// code starts here // Custom method to be called from OnChange event o Shipping Method dropdown. functionOnChangeShippingMethod() { // If Shipping method is DHL if (Xrm.Page.getAttribute("address1_shippingmethodcode").getText() == "DHL") { var control = Xrm.Page.getControl("address1_shippingmethodcode"); //Define action collection varactionCollection = { message: 'This will change freight terms to FOB. Do you want to proceed?', actions: null }; actionCollection.actions = [function () { // do your action here // set freight terms to FOB Xrm.Page.getAttribute("address1_freighttermscode").setValue(1); control.clearNotification('someid'); }]; // Alet the user. The function takes an object of 4 arguements. control.addNotification({ messages: ['Change Freight Terms?'], notificationLevel: 'ERROR', uniqueId: 'someid', actions: [actionCollection] }); } } // code ends here
Once Apply button is clicked…
You can handle else condition subsequently and clear the notification.
// code starts here …… …… else { control.clearNotification("someid"); } // code ends here
You read that how identification is different from available method in Dynamics 365 in this post. The CRM development company has also explained the use of Form and Field notifications. If you have any question, ask experts through comments.