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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Instead of Error Message when chosing a field value, showing a Warning / Note without locking the field ??

(0) ShareShare
ReportReport
Posted on by 17

Hi experts, 

I am trying to show a warning message when a user is chosing a specific value in an option set. The Error Message created through a business rule would actually be perfect - BUT users should still be able to chose this value. With the error message, the value is locked and cannot be used. 

Is there a way to unlock the field and still have the error message appearing? 

Or is there maybe a different way of kind of showing a warning message? 

I know about the "recommendation" function, but it doesn't suit our needs since the user must click on the symbol to see the message. We need something that kind of pops up and draws attention... 

Thank you so much for any ideas!! 

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi yvka123,

    You need to write something similar to below:

    function myfunction() {
        try {
            let formContext = _primaryControl;
            let optionSetValue = this.getValue(formContext, "maa_paymentgateway");
            if (optionSetValue === 809790000)
                openAlertDialog("This is alert");
                
        } catch (e) {
            openAlertDialog("Error"   e.message   ".");
        }
    }

    function getValue(_formContext, _attribute) {//If control is missing than return ""
        let value = "";
        try {
            if (this.getControl(_formContext, _attribute) === true)
                value = _formContext.getAttribute(_attribute).getValue();
        } catch (e) {
            this.openAlertDialog("Error in getValue: "   e.message   ".");
        }
        return value;
    }

    function getControl(_formContext, _control) {
        let control = false;
        try {
            if (_formContext.getControl(_control))
                control = true;
        } catch (e) {
            openAlertDialog("Error in getControl: "   e.message   ".");
        }
        return control;
    }

    function openAlertDialog(_text) {
        try {
            Xrm.Navigation.openAlertDialog(_text);
        } catch (e) {
            Xrm.Navigation.openAlertDialog("Error in openAlertDialog: "   e.message   ".");
        }
    }

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp: 923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • yvka123 Profile Picture
    17 on at

    Hi Abdul,

    thank you so much for your reply! Is there any way to do this in Low Code?

    I'm not a programmer unfortunately.

    Thanks

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi yvka123,

    I do not this there is any other way. 

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans