Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

How to open webresource in Dynamics 365 for Mobile?

Posted on by 10

Hi, everyone.

We have several custom buttons which open custom html webresources.

They work properly in web. But now we need to configure Dynamics 365 for Mobile application.

When im using the latest  function like this:  Xrm.Navigation.openWebResource("mysource", "windows options"), it doesn't have any actions.

Is the function be deprecated for mobile?

  • Suxsem Profile Picture
    Suxsem 10 on at
    RE: How to open webresource in Dynamics 365 for Mobile?

    Hi Luis,

    did you find a solution to the issue?

    I'm still facing the same...

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How to open webresource in Dynamics 365 for Mobile?

    Hi Luis,

    I've tried again, but sorry for that I didn't find any potential reason.

    You could try change app version if your phone is Android.(or any available version update if iOS)

    Because you said that the function could work previously,

    if above step still not works, 

    please open a support ticket for help:

    https://admin.dynamics.com/?referer=mbssupport

    Regards,

    Clofly

  • Luis Yang Profile Picture
    Luis Yang 10 on at
    RE: How to open webresource in Dynamics 365 for Mobile?

    Hi Clofly,

    I tried your code like this: 

    function openWebResourceFunc() {
       var client = Xrm.Utility.getGlobalContext().client.getClient();
       if (client === 'Mobile') {
         try {
           var confirmStrings = { text: "You're in "   client   " client.", title: "Notice" };
           var confirmOptions = { height: 150, width: 250 };
           Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
             function(success) {
               if (success.confirmed) {
                 var windowOptions = { openInNewWindow: true, height: 400, width: 400 }
                 
                 //Add
                 alert('Ready to open webresource');
                 
                 Xrm.Navigation.openWebResource("cr1e3_custombutton", windowOptions);
                 // Try deprecated api if above not works
                 // Xrm.Utility.openWebResource("webresource name"); 
                 console.log("Dialog closed using OK button.");
               } else {
                 console.log("Dialog closed using Cancel button or X.");
               }
             });
         } catch (err) {
           openAlert("Oh..", "An error occured: "   err, "Ok");
         }
       } else {
         openAlert("Hi", "The function only works on mobile client", "Close");
       }
     }
    
     function openAlert(titleContent, textContent, buttonContent) {
       var alertStrings = { confirmButtonLabel: buttonContent, text: textContent, title: titleContent };
       var alertOptions = { height: 150, width: 250 };
       Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
         function success(result) {
           console.log("Alert dialog closed");
         },
         function(error) {
           console.log(error.message);
         }
       );
     }

    And I got the following message:

    5504.AA.png

    After click OK button, system didn't have any action, and back to list.

    Others api works fine, but Xrm.Navigation.openWebResource has issue.

    The function can be execute 3 days ago, but now it doesn't work. 

    Luis

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How to open webresource in Dynamics 365 for Mobile?

    Hi Luis,

    Try my code below:

    function openWebResourceFunc() {
       var client = Xrm.Utility.getGlobalContext().client.getClient();
       if (client === 'Mobile') {
         try {
           var confirmStrings = { text: "You're in "   client   " client.", title: "Notice" };
           var confirmOptions = { height: 150, width: 250 };
           Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
             function(success) {
               if (success.confirmed) {
                 var windowOptions = { openInNewWindow: true, height: 400, width: 400 }
                 Xrm.Navigation.openWebResource("cr1e3_custombutton", windowOptions);
                 // Try deprecated api if above not works
                 // Xrm.Utility.openWebResource("webresource name"); 
                 console.log("Dialog closed using OK button.");
               } else {
                 console.log("Dialog closed using Cancel button or X.");
               }
             });
         } catch (err) {
           openAlert("Oh..", "An error occured: "   err, "Ok");
         }
       } else {
         openAlert("Hi", "The function only works on mobile client", "Close");
       }
     }
    
     function openAlert(titleContent, textContent, buttonContent) {
       var alertStrings = { confirmButtonLabel: buttonContent, text: textContent, title: titleContent };
       var alertOptions = { height: 150, width: 250 };
       Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
         function success(result) {
           console.log("Alert dialog closed");
         },
         function(error) {
           console.log(error.message);
         }
       );
     }

    Have you tested that whether other Xrm apis could work in mobile app?

    Regards,

    Clofly

  • Luis Yang Profile Picture
    Luis Yang 10 on at
    RE: How to open webresource in Dynamics 365 for Mobile?

    Hi Clofly,

    Thanks for help!

    CRM online version:  1710 (9.1.0.11134) online

    Mobile APP version:  13.19122.5

    I enabled option for mobile already.

    And I tried to add alert function before "Xrm.Navigation.openWebResource".

    It works fine, but system did't navigate to the web resource.

    Any ideas?

    Luis

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How to open webresource in Dynamics 365 for Mobile?

    Hi Luis,

    Could you share me your CRM version and more details if possible?

    I tested Xrm.Navigation.openWebResource in D365 online:

    I add the function on a custom ribbon button, and I'll be navigated to a full page to web resource after I click the button.(iOS)

    Have you enable the option for mobile?

    pastedimage1576486806888v1.png

    Also, try to:

    1. add an alert before openWebResource to test whether you whole function executes in mobile app,

    2. sign out then sign in again to test.

    Regards,

    Clofly

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans