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
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!
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()")
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.
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.
2) Click New. Enter Name, Display Name, Description, and select Script (JScript) in Type. Click Text Editor.
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!"); }
4) Click Add on the Lookup Record screen. Then click Add in the Event Handlers of the Field Properties interface.
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.
Go back to Contact, refresh the current page, modify the Mobile Phone field, and the popup window appears.
This is the easiest way to use JS events on the form.
Hope this helps.
Best Regards,
Lu Hao
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?
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?
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
Did you refer the above suggestions? You can add a recommendation as mentioned above.
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
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.
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.
Hi partner,
You could refer to this article, use JavaScript to encode and add an Onchange event to the field.
If I modify this field with an Onchange event, it will pop up.
If I modify this field with the Onchange event, a warning message will appear.
You could know how to add JavaScript to the form in this article.
Hope this helps.
Best Regards,
Lu Hao
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156