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

  • Damesh Peri Profile Picture
    123 on at
    RE: Notification Dynamics 365

    Thanks guys, both coding works as i require.

  • Verified answer
    Shahbaaz Ansari Profile Picture
    6,211 on at
    RE: Notification Dynamics 365

    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

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Notification Dynamics 365

    Hi,

    Yes, replace the 1 into 928350002

  • Damesh Peri Profile Picture
    123 on at
    RE: Notification Dynamics 365

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

    Thanks in advance.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Notification Dynamics 365

    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');

    }

    }

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans