web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Cannot call a Custom P...
Power Apps
Unanswered

Cannot call a Custom Page from a Custom Main Grid

(0) ShareShare
ReportReport
Posted on by 945

Hi guys,

 

I created a custom page and after published, I'm planning to call this page (entry form) from a Main Grid of my Model-driven menu.

Following Reza's video -> https://www.youtube.com/watch?v=XMopL0r8k3k especially on minute 25:40 for the command designer, also this Microsoft Doc https://docs.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/navigate-to-custom-page-examples#open-as-an-inline-full-page-without-context  here is my step :

  • Get my logical name of Custom Page         

Axal_1-1651542941748.png

  • Create new Web Resource
function OpenCanvasExpense()
{
var pageInput = {
	pageType: "custom",
	name: "new_newexpensecustom_e990e",
};
var navigationOptions = {
	target: 1
};
Xrm.Navigation.navigateTo(pageInput, navigationOptions)
	.then(
		function () {
		{
	).catch(
		function (error) {
		}
	);
}
  • Save and Publish
  • Go to my Model-driven, Edit in Preview, look for my menu (Subarea), click three dots for Edit command bar

Axal_2-1651543217575.png

  • Choose Main Grid
  • Choose Add Command for new command button in that main grid.
  • Set for calling the Web resource ->

Axal_3-1651543429120.png

  • Save and Publish

 

The new button appear in my App, but nothing showing when I click the button. 

 

Anyone can help what did I missed ?

 

Thanks

 

 

 

I have the same question (0)
  • Mira Ghaly Profile Picture
    11,413 Moderator on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    @Axal 

    For troubleshooting can you add an alert at the beginning of your JavaScript function to see if it is called from the command or not?

  • Axal Profile Picture
    945 on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Hi @Mira_Ghaly or anyone 

     

    I'm sorry, I'm not really understand Javascript, where actually I can put the Alert ? of this code :

     

     

    function OpenCanvasExpense()
    {
    var pageInput = {
    	pageType: "custom",
    	name: "new_newexpensecustom_e990e",
    };
    var navigationOptions = {
    	target: 1
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    	.then(
    		function () {
    		{
    	).catch(
    		function (error) {
    		}
    	);
    }

     

     

    Thanks

  • Mira Ghaly Profile Picture
    11,413 Moderator on at
    Re: Cannot call a Custom Page from a Custom Main Grid

     

    @Axal 

    I noticed a syntax error and add a bit of modification as well as the Alert so that you can try at your side and trouble shoot it  a bit further

    function OpenCanvasExpense()
    {
    alert("Function Open Canvas App Called");
    var pageInput = {
    	pageType: "custom",
    	name: "new_newexpensecustom_e990e"
    };
    var navigationOptions = {
    	target: 1,
     width: 800, // value specified in pixel
     height: 700, // value specified in pixel
     position: 1
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    	.then(
    		function () {
    		{
    	).catch(
    		function (error) {
    		}
    	);
    }

     

     

  • Axal Profile Picture
    945 on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Thanks, I changed the script accordingly, It looks like the script has never been called as the alert not shown. 

    Anything wrong with step ? 

    • Go to my Model-driven, Edit in Preview, look for my menu (Subarea), click three dots for Edit command bar

    Axal_0-1651701463107.png

     

    • Choose Main Grid
    • Choose Add Command for new command button in that main grid.
    • Set for calling the Web resource ->

    Axal_1-1651701463624.png

     

    • Save and Publish

     

    I tried to just change the command (button) text to just make sure this Model-driven is published and it is opened the new one, which it did. But the button still nothing when it is click.

     

  • Mira Ghaly Profile Picture
    11,413 Moderator on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    @Axal 

    It might be a silly question have you added the Javascript as a web resource first to the solution?

     

  • Axal Profile Picture
    945 on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Hi @Mira_Ghaly 

     

    I think there is no such question a silly question to me, in fact I did remember there was once we need to register first the Web Resource in the related Model-driven form, do I still need that ? For the "edit main grid" it self, I can't see any register except the "+ Add Library" button which the place I select my newly created Web resources.

     

    For the solution, I add the new Web resources from my solution, so it already inside my solution. And I also try to "Publish all customization" from the solution, just to try my luck, but none of this work. It seems the new button really do nothing.

     

    Appreciate any help and suggestion, so feel free to ask anything as I ran out of idea now. It is very easy if looking at Reza's video or other same video about this "commanding"

     

    Thanks

  • Axal Profile Picture
    945 on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Hi,

     

    Not sure what happened, but I re-do all my work again including create new Custom Page and Web Resource, but I changed the script with the one with the context ->

    function openPageInlineWithContext(selectedItems)
    {
     var selectedItem = selectedItems[0];
    
     if (selectedItem) { 
     let pageInput = {
     pageType: "custom",
     name: "new_expensecustom_09d77",
     entityName: selectedItem.TypeName,
     recordId: selectedItem.Id,
     };
     let navigationOptions = {
     target: 1
     };
     Xrm.Navigation.navigateTo(pageInput, navigationOptions)
     .then(
     function () {
     // Handle success
     }
     ).catch(
     function (error) {
     // Handle error
     }
     );
     }
    }

     

    This one is working.

    Since the previous script is actually for testing only so probably I can say it is solved. Although I'm still curios why it is not working. 

     

    @Mira_Ghaly Thanks for your help.

  • v-xiaochen-msft Profile Picture
    on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Hi @Axal ,

     

    Glad to see the issue has been solved.

    You could mark the correct reply to close the case.

    Besides, I think the error may be caused by the following points:

    1\ After you have applied the js for your mda, you may need to refresh the page a few times for it to work due to the cache.

    2\ Maybe you didn't publish all your components correctly, like your js resources...

     

    Best Regards,

    Wearsky

  • Verified answer
    Axal Profile Picture
    945 on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Hi @v-xiaochen-msft 

     

    Yeah, actually curios why the script not working. As those two thing you're pointed out, I can confirmed I already did. And since all the related object are in my Solution, I did using the Publish all customization to make sure nothing left behind.

     

    FYI, after the re-create and succeeded with other script, I tried to re-do again and this time still using the non-working script, but it turns out still not working.

     

    I will close it after a while later.

     

    Thanks

     

  • AleMar Profile Picture
    4 on at
    Re: Cannot call a Custom Page from a Custom Main Grid

    Man just wanted to thank you, you saved my life. I had the very same experience (but with Ribbon Workbench for parameters management), and struggled a lot to make it work. Cheers!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard