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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to pass GUID to cu...
Power Apps
Answered

How to pass GUID to custom page from Model driven app Main form custom button

(0) ShareShare
ReportReport
Posted on by 24

I have a Model driven app, from where i will open a record, then i have a custom button. When user clicks on it, it should open a custom page where user will couple of fields along with attachments.
I was following the blog https://dynatecon.com/2022/07/25/call-custom-page-with-parameters-from-model-driven-app-using-new-command-editor/, but no luck when i press button it doesn't work at all.
Note: Custom button is on Main form.
I just need to pass the GUID of record from form to Custom page, so that user can add attachments and provide more info.

Please help me what i am missing?

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    salaam @imranimzzy  - is the custom page not launching at all when the button is clicked, or is the page opening, but the GUID is not passing as a parameter? (and thus a blank page).

     

    If the page is just not launching, have you attempted these checks?

     

    • Use static values in your JS code as opposed to parameters to diagnose the problem
    • Double check the custom page is added to the model driven app as well as from the Solution
    • Published the custom page and the model driven app on every change
    • Used the logical name of the custom page as opposed to the display name
  • imranimzzy Profile Picture
    24 on at

    Walekumassalam Amik,

    Thanks for your quick reply, Yes Its not at all navigating to the Custom page.
    I have added the custom page to my solution and i am using the logical name of page and  in my javascript too.
    I am adding the script and configuration please check and let me know any mistake in that.

    Yes, i do have tested by passing the static values of Entity and Record GUID that doesn't work either.


    function openPageInlineWithContext(pageContext){

    var rec = pageContext.data.entity.getId();

    var record = rec.replace(/[{}]/g,"");

    Xrm.Navigation.navigateTo({

    pageType: "custom",

    name: "crc21_page1_c7470",

    entityName: pageContext.data.entity.getEntityName(),

    recordId: record },

    { target:2,

    width: 780,

    height: 500,

    title: "Upload Onboarding Documents"}

    ).then( function () { // Handle error }

    ).catch(

    function (error) { // Handle error } );

    }


    This is my configuration and parameter passed as PrimaryControl.

    imranimzzy_0-1681726688204.png

     

  • Verified answer
    Ami K Profile Picture
    15,689 Super User 2024 Season 1 on at

    salaam brv, the JS code from that blog does not look right. There is an extra curly bracket which should not be there.

     

    Picture1.png

     

    I have made a slight revision to the js and loaded it into my environment, it works.

     

     

    function openPageInlineWithContext(pageContext){
    
     var rec = pageContext.data.entity.getId();
    
     var record = rec.replace(/[{}]/g,"");
    
     Xrm.Navigation.navigateTo({
    
     pageType: "custom", 
    
     name: "new_videowalkthrough_c290c", 
    
     entityName: pageContext.data.entity.getEntityName(), 
    
     recordId: record },
    
    { target:2,
    
     width: 780,
    
     height: 500,
    
     title: "Upload Onboarding Documents"}
    
     ).then( function () {
     // Refresh the main form when the dialog is closed
     primaryControl.data.refresh();
     }
    
    ).catch (
     function (error) {
     // Handle error
     }
     );
    }

     

     

    If you're still not able to launch anything from the button, consider creating another model driven app in a different solution and see if it works?

     

    ------------------------------------------------------------------------------------------------------------------------------

     

     If I have answered your question, please mark your post as Solved.

    If you like my response, please give it a Thumbs Up.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard