Wednesday, 27 February 2019

Alert and Confirm syntax will not work for Dynamics 365 App For Outlook

Recently, I just helped customer to upgrade their system to 9.1.x.x
We encountered many issues. However, the issue that I want to bring up now is issue regarding to the App for Outlook

We found that there is custom ribbon that calls Custom Javascript and it does nothing, no error, nothing is so-called exception occurred because I did debugging and did place the try catch block.
Unlike using Web, the debugging in Outlook is not so easy.
After I did debugging with try catch, I found out that the script is actually running well and has no error.

So, the problem is: the script that is executed is pretty simple just do some validation and show alert when does not fulfill, then throw a confirmation dialog then save the form.
Yes, the script is sucessfully executed from start to the end.

Then, why the ribbon function is not running?



It is because the alert and confirm scripts are still using old ways:

alert("Please complete all mandatory fields before submitting the form")
if (!confirm("Are you sure that you want to submit this form??")) {
            return;


So, there is no error it is just not 'supported' and not 'translated' well in the App for Outlook.
yes, it does working in Web, but not in App for Outlook.

So, after I changed it to

 Xrm.Utility.alertDialog("Please complete all mandatory fields before submitting the form");
or
    var alertStrings = { confirmButtonLabel: "OK", text: "Please complete all mandatory fields before submitting the form" };
    var alertOptions = { height: 100, width: 500 };
    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);

and

if (!Xrm.Utility.confirmDialog("Are you sure that you want to submit this form??")) {
            return;
        }

It is working perfectly!
Example:








**The first one is still supported and it is intended for simple alert.
Xrm.Utility namespace may be obsolete for the Alert and Confirm Dialog, so as per MSDN recommendation, we need to change it :
https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation/openalertdialog

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-navigation/openconfirmdialog

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility

Hope it helps!

Thanks




17 comments:

  1. Very good content. I read your blog that was awesome, please doing continue daily post. Customer Relations Software in Indore

    ReplyDelete
  2. this is the best softwre you can do this foe small business B2B Lead Generation Software. this software for handle online accounting

    ReplyDelete
  3. We the biggest BRS Photoshop Service As images of products are the biggest weapon for a business company. Perfect photoshop service means a lot to this professional business purpose. Do Visit to have more knowledge about unique service.

    ReplyDelete
  4. Excellent blog information provided by the author
    Best Play and Pre School for kids in Hyderabad,India. To give your kid a best environment and learning it is the right way to join in play and pre school were kids can build there physically, emotionally and mentally skills developed. We provide programs to kids like Play Group, Nursery, Sanjary Junior, Sanjary Senior and Teacher training Program.
    ­play school in hyderabad

    ReplyDelete
  5. Perbedaannya adalah pada permainan Bandar Sakong, masing-masing bettor mendapatkan 3 kartu remi. Permainan sakong terdiri dari 8 bettor yaitu 1 orang jadi bandar dan 7 lainnya adalah bettor
    asikqq
    dewaqq
    sumoqq
    interqq
    pionpoker
    bandar ceme
    hobiqq
    paito warna terlengkap
    Syair HK

    ReplyDelete
  6. server installation and configuration services
    WELCOME TO ANIKA TECH SUPPORT
    Anika Tech Support managed by a team of professionals utilising a combined 20+ years of experience in IT support and Managed IT services Focusing on Proactive support, continuity, growth and development. We are a forward thinking IT Company who support public and private sector using the latest tech as a driving force for our client’s Success.

    ReplyDelete
  7. Packers and Movers Bangalore Near me - Get Verified and Expert Shifting Service Providers, Who can Help you With 24x7 and Safe, Affordable Services for National Household Relocation. Compare Charges and Time, Save Money.

    ReplyDelete
  8. Good explanation of the topic

    Sanjary Academy is the best Piping Design institute in Hyderabad, Telangana. It is the best Piping design Course in India and we have offer professional Engineering Courses like Piping design Course, QA/QC Course, document controller course, Pressure Vessel Design Course, Welding Inspector Course, Quality Management Course and Safety Officer Course.
    Piping Design Course in Hyderabad ­

    ReplyDelete
  9. List of Best Carpenters Service Near me in Bangalore - Top Rated Carpenter in Bangalore, Book Carpenter Services Online in Bangalore, Book Carpentry Services Online at Home In Bangalore. Get Free Best Price Quotes Carpenters Service in Bangalore Compare Charges, Save Money And Time @ Carpenters in Bangalore

    ReplyDelete
  10. List of Best House Painters Service Near me in Bangalore - Top Rated House Painters in Bangalore, Book House Painters Services Online in Bangalore, Wall Painters in Bangalore. Best Price Quotes House Painters Service in Bangalore Compare Charges, Save Money And Time @ House Painters in Bangalore

    ReplyDelete
  11. List of Best Plumbers Services Near me in Bangalore - Top Rated Plumbers in Bangalore, Book Plumbing Services Online in Bangalore, Get Certified Technician at Your Doorstep for Plumbers Services. Best Price Quotes Plumbers Service in Bangalore Compare Charges, Save Money And Time @ Plumbers in Bangalore

    ReplyDelete
  12. List of Best Electronic Service Near me in Bangalore - Top Rated Electrician in Bangalore, Book Electronic Services Online in Bangalore, Get Certified Technician at Your Doorstep for Electronic Services. Best Price Quotes Electronic Service in Bangalore Compare Charges, Save Money And Time @ Electricians in Bangalore

    ReplyDelete
  13. Excellent product by Microsoft.Thanks for sharing Surya Informatics

    ReplyDelete
  14. Thanks for sharing such a great information with us.Keep on updating us with these types of blogs.
    professional web design company in chennai

    ReplyDelete

My Name is..