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

Announcements

No record found.

News and Announcements icon
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

  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans