web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Notification Dynamics 365

(0) ShareShare
ReportReport
Posted on by 123

Hi, 

I am trying to set up a field based notification on a contact form.

e.g. I have a field named Membership, which is option set with three options. I would like a notification when i choose one of the options.

I have tried the below code but it shows a notification regardless of the option i choose. 

function setMembershipNotification() {  
    var membership = Xrm.Page.getAttribute("spl_membership").getValue();  

    if (!membership) {
Xrm.Page.ui.setFormNotification("You are a Executive Memeber", "INFO", "928,350,002");

else {
Xrm.Page.ui.clearFormNotification('928,350,002');
}
}

Any suggestions on how i might be able to do this.

Thanks

Damesh

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi

    if the option set value that you want to show notification is 1. you have to look the value in customization mode.

    function setMembershipNotification() {  

       var membership = Xrm.Page.getAttribute("spl_membership").getValue();  

       if (membership == "1") {

    Xrm.Page.ui.setFormNotification("You are a Executive Memeber", "INFO", "928350002");

    }

    else {

    Xrm.Page.ui.clearFormNotification('928350002');

    }

    }

  • Damesh Peri Profile Picture
    123 on at

    The value for the option set for Executive Member is 928350002. So will i replace the '1' with this value?

    Thanks in advance.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    Yes, replace the 1 into 928350002

  • Verified answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    you can also check if membership value contain data or not link below,

    function setMembershipNotification() {  

       var membership = Xrm.Page.getAttribute("spl_membership");

    if(membership!=null && membership.getValue()!=null)

    {

    if (membership.getValue() == 'yourvalue') {

    Xrm.Page.ui.setFormNotification("You are a Executive Memeber", "INFO", "928,350,002");

    }

    else {

    Xrm.Page.ui.clearFormNotification('928,350,002');

    }

    }

    }

    Best Regards,

    Shahbaaz

  • Damesh Peri Profile Picture
    123 on at

    Thanks guys, both coding works as i require.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans