Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

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

Posted on by 162

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!! 

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Instead of Error Message when chosing a field value, showing a Warning / Note without locking the field ??

    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/.../

  • yvka123 Profile Picture
    yvka123 162 on at
    RE: Instead of Error Message when chosing a field value, showing a Warning / Note without locking the field ??

    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
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Instead of Error Message when chosing a field value, showing a Warning / Note without locking the field ??

    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/.../

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans