Skip to main content

Notifications

Dynamics 365 general forum

Display a reminder message for users

Posted on by 85

Hi, 

Is there a no coding way to display a warning message for users when they change certain fields? It should not stop saving the record, just display a message to remind them another action they have to do. 

Thanks

  • William Bradley Profile Picture
    William Bradley 175 on at
    RE: Display a reminder message for users

    Hi there.  I was researching this for a piece of functionality on an Opportunity form, where I want to show a Warning on a Date/Time field.  I implemented the Function above for WARNING, and it works great - thank you!  

    However, I had a question.  Can you hide the warning if/when the Opportunity is closed?  Or show it just for a set time period (1 minute, etc.)  I am finding that as the field changes, it adds more and more Warnings.  You can bypass them and still save the record or close the record, but I was wondering if there were parameters on how long the (multiple) Warnings could be set to appear, or if they can be hidden when Status = Closed.  

    Let me know, thanks!  

  • Suggested answer
    LuHao Profile Picture
    LuHao 40,872 on at
    RE: Display a reminder message for users

    Hi partner,

    Haha, I also encountered this problem when I first learned Javascript.  :)

    This is because the Function name added in Event Handlers is selected incorrectly.

    You should choose WC instead of OnChangeFinalInvDate. (The Function name in "function WC()")

    1346.8.JPG

    Below I will show you step by step using the simplest JavaScript.

    If my goal is: When I change the Mobile Phone field, a warning message will displayed.

    4011.2.JPG

    1) Open the form editor and go to the Field Properties interface of Mobile Phone. Under Event tab, click Add button in the Form Libraries.
    5355.3.JPG

    2) Click New. Enter Name, Display Name, Description, and select Script (JScript) in Type. Click Text Editor.

    6431.4.JPG    7774.5.JPG

    3) Enter the JavaScript code in Source. Click OK. Then click Save. Turn off this window.

    function WarningMessage() {
    alert("Don't forget to add the Case to the Cancellation Queue!");
    }

    8306.6.JPG    0358.7.JPG

    4) Click Add on the Lookup Record screen. Then click Add in the Event Handlers of the Field Properties interface. 

    1346.8.JPG    1680.9.JPG

    5)  In the Handler Properties window, select the newly created JS in the Library (New_OnChangeFinallnvDate), and enter the name of JS code in the Function (WarningMessage). Click OK. Then click OK on the Field Properties screen. Finally click Save in the form editor, then click Publish.

    2043.10.JPG

    Go back to Contact, refresh the current page, modify the Mobile Phone field, and the popup window appears.

    7024.11.JPG

    This is the easiest way to use JS events on the form.

    Hope this helps.

    Best Regards,

    Lu Hao

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Display a reminder message for users

    Hi,

    Generally the error "ReferenceError: <methodname> is not defined" occurs if CRM is loading older script and unable to find the new method or you have any syntax error in your JavaScript so the JS library itself is not loading so CRM is unable.

    1) So publish all customization and try it in a new browser session

    2) Press f12 and see if you are getting any JS errors on browser console. If yes, review your JS and fix the syntax issue based on the error.

    Did you try the business rule - recommendation?

  • Teach Me Profile Picture
    Teach Me 85 on at
    RE: Display a reminder message for users

    Hi All,

    Thank you all for the help, I tried very hard not to use JavaScript, but I guess the only method to this to go with Lu's suggestion. 

    I tried the ALERT method, but I'm not having much luck.

    Here is what I've done:

    function WC() {

    alert("Don't forget to add the Case to the Cancellation Queue!");

    }

    And I'm having a script error on the form:

    One of the scripts for this record has caused an error. For more details, download the log file.
    ReferenceError: OnChangeFinalInvDate is not defined at eval (eval at RunHandlerInternal 

    The log file shows this:

    ReferenceError: OnChangeFinalInvDate is not defined

    Any idea what went wrong please?

  • LuHao Profile Picture
    LuHao 40,872 on at
    RE: Display a reminder message for users

    Hi partner,

    If non coding ways don't meet your requirements, the Javascript I provide can solve your problem.

    And the operation is very simple.

    If you have any difficulty using Javascript, please feel free to post, I will pay attention to it.

    Hope this helps.

    Best Regards,

    Lu Hao

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Display a reminder message for users

    Did you refer the above suggestions? You can add a recommendation as mentioned above.

  • Teach Me Profile Picture
    Teach Me 85 on at
    RE: Display a reminder message for users

    Hi All,

    Thank you for your suggestions. I probably wasn't specific enough. I would like to display a message for users if they modify the contract end date on a case to warn them to add the case to a queue. I don't think I could do that with a workflow or a business rule.

    Thanks

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Display a reminder message for users

    Hi,

    The easiest no code way is to use Business Rule and display recommendation

    Refer these:

    neilparkhurst.com/.../dynamics-365-business-rules

    www.magnetismsolutions.com/.../how-to-use-recommendations-in-dynamics-365-business-rules

    Hope this helps.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Display a reminder message for users

    Hi,

    There is only business rules which is  fire on change event if you don't write  JS code, using business rules you can achieve following-

    Set field values

    Clear field values

    Set field requirement levels

    Show or hide fields

    Enable or disable fields

    Validate data and show error messages

    Create business recommendations based on business intelligence.

    Above things you can do using business rules,there is no warn message capability except recommendations.

    Apart from Business Recommendations  ,you may do one thing create a separate multiline text field saying warning and add in the top of the form.Make field read only and set your warn message there based on condition using business rules set value.

    By default make the field hidden and display the field only when you want to show warning.

  • LuHao Profile Picture
    LuHao 40,872 on at
    RE: Display a reminder message for users

    Hi partner,

    You could refer to this article, use JavaScript to encode and add an Onchange event to the field.

    • The simplest is alert("message") method. This will only pop up a small reminder window.

    1348.4.JPG

    If I modify this field with an Onchange event, it will pop up.

    8272.2.JPG

    • You can also use Xrm.Page.ui.setFormNotification("message","WARNING") method.

    2806.3.JPG

    If I modify this field with the Onchange event, a warning message will appear.

    1348.4.JPG

    You could know how to add JavaScript to the form in this article.

    Hope this helps.

    Best Regards,

    Lu Hao

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans