Search code examples
notificationsdynamics-crmcrmdynamics-crm-365

In addNotification how to change the Apply button


When I try to use addNotification method I must use Apply button... But in the action I don't necessarly need to Apply something I can show something or do whatever I want, so I want to know if it's possible to Change the Label (or DELETE) the button "Apply".

here is my code:

                var actionCollection = {
                    message:'test text',
                    actions: null
                };

                actionCollection.actions = [function () {
                    for(var j=0 ; j < result_object.id.length ; j++){
                        console.log("test")

                }];

                Xrm.Page.getControl("field_name").addNotification({
                    messages: ['test text 2'],
                    notificationLevel: 'RECOMMENDATION',
                    uniqueId: 'my_unique_id',
                    actions: [actionCollection]
                });

and here is a lookup to the apply button: The Apply Button


Solution

  • It looks like the functionality is limited & predefined when you add notification. You cannot customize more than that.

    The addNotification method displays a notification with the messages you specified and two standard buttons: Apply and Dismiss. Clicking Apply executes the action you define; clicking Dismiss closes the notification message.

    Reference

    Maybe you should try Xrm.Navigation.openConfirmDialog for achieving your requirement. Read more