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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to pass Guid Pa...
Power Apps
Unanswered

Trying to pass Guid Parameter to a Custom Page

(1) ShareShare
ReportReport
Posted on by 105

Hey All,

 

I have a custom page which I am navigating to from a custom ribbon button on a subgrid for Entity B that is on a form for Entity A. I'm using the custom page as a sort of quick create form for a record in Entity B that is a child of Entity A. I am passing the GUID for the parent record from Entity A with the Javascript on the subgrid button:

 

 

this.navigate = function (primaryControl) {
 formContext = primaryControl;
 let entityA_Id = formContext.data.entity.getId().replace('{', '').replace('}', '');
 console.log('entityA_Id: ' + entityA_Id); // Correctly logs GUID of Entity A parent record
 let pageInput = {
 pageType: "custom",
 name: "my_customPage_gr34d",
 entityName: formContext.data.entity.getEntityName(),
 recordId: entityA_Id // Passing the GUID of Entity A parent record
 };
 let navigationOptions = {
 target: 2,
 position: 1,
 height: 600,
 width: 800,
 title: "Add Shift Breakdown"
 };
 Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(
 function success() {
 console.log("Success");
 },
 function error() {
 console.log("error");
 }
 );
 }

 

 

In my Custom Page on the OnStart property I have the following code:

 

Set(_thisRecord,
 If(IsBlank(Param("recordId")),
 Blank(),
 LookUp(
 Placements,
 'Placements (cr05d_placementsid)' = GUID(Param("recordId"))
 )
 )
);

 

 

 

I have tried testing by adding a label on the custom page with value of _thisRecord.{recordId} but it won't populate. 

 

Am I passing or trying to read the GUID incorrectly?

 

Please let me know if I can clarify anything else

I have the same question (0)
  • 365-Assist Profile Picture
    2,324 Moderator on at

    I made a video that may help you. At about the 8-minute mark I explain how to pass the Guid. although mine goes to a flow I am sure you can pass yours to a Custom Page.

     

    How to create a button in a Model Driven (Dataverse) Power App that launches P.A. Flow in a Solution - YouTube

     

    ---------------------------------------------------
    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

    Subscribe: https://www.youtube.com/channel/UCFpvUlpx84FuIPOdInGKMTw
    Twitter: https://twitter.com/assist_365

    Regards
    Darren Lutchner - 365 Assist

     

     

  • simran_s Profile Picture
    2 on at

    Hi @Cosmic_Kitchen , i am facing similar issue. i am receiving blank record id in my custom page. How were you able to achieve the functionality?

  • Cosmic_Kitchen Profile Picture
    105 on at

    @simran_s I am sorry because I know this isn't very helpful, but I don't remember what ever came of this. The solution that this specific post was about ended up getting scrapped. 

     

    However I have continued using this pattern as above in my initial post successfully several times. I don't remember where my mess up was with this one. But I have an identical pattern currently working in several other custom pages. 

     

    You could test that your JavaScript is successfully passing the parameter at all by adding a text label to your page with something like this in the Value property:

    If(
     IsBlank(Param("recordId")),
     "NO PARAMETER",
     "PARAMETER PASSED"
    )

     

    If your label reads "PARAMETER PASSED", then I would next look at your LookUp() function and make sure that you have selected the appropriate GUID field for the record, and additionally, If you were calling this from a subgrid like I was in this post, make sure you are passing the GUID for the appropriate record (parent table record vs. subgrid table record).

     

    Also, just to confirm, you are testing this as a published page and not in the editor.

  • rrizwann Profile Picture
    4 on at

    I have also sent the GUID of the records to the custom page, and this is my JavaScript.

    function sendLink(executionContext) {
     formContext = executionContext;
     var recordId = formContext.data.entity.getId();
    
     var pageInput = {
     pageType: "custom",
     name: "crd92_sharelink_8f4f6",
     entityName: formContext._entityName, // Entity Name
     recordId: recordId // Input Parameter For Custom Page
     };
    
     var navigationOptions = {
     target: 2,
     width: 450,
     height: 300
     };
    
     Xrm.Navigation.navigateTo(pageInput, navigationOptions)
     .then(
     function () {
     formContext.data.refresh();
     }
     )
     .catch(
     function (error) {
     formContext.data.refresh();
     }
     );
    }

     

    This is the Form Command

    rizwan002_0-1701279494532.png

    I have obtained the GUID through the parameter in the Custom Page

    LookUp('Environment Variable Values', 'Environment Variable Definition'.'Display Name' = "SHP Sales").Value + ".crm.dynamics.com/main.aspx?appid=bab85929-32df-eb11-bacb-00224805a750&pagetype=entityrecord&etn=" + Param("entityName") + "&id=" + Param("recordId");

    rizwan002_1-1701279661785.png

     

     

  • Suggested answer
    HR-09070029-0 Profile Picture
    2 on at
    Hi after much bashing of head on desk I have solved this challenge, and I believe this should be marked as the correct answer:

    Here is the JavaScript to launch the Power Apps Custom Page as a pop over dialog window from Dynamics 365 model driven app form, launched from a Command Button (ribbon):
     
    unction OpenCustomPage(primaryControl) {
     
    var formContext = primaryControl;
     
    var getId = Xrm.Page.data.entity.getId();
     
    var myRecordId = getId.replace(/[{}]/g,"");
     
    var pageInput = {
    pageType: "custom",
    name: "prefix_yourcustompagelogicalname",
    recordId: myRecordId
    };
    var navigationOptions = {
    target: 2,
    position: 1,
    width: {value: 80, unit:"%"},
    title: "Your Custom Page Name"
    };
    Xrm.Navigation.navigateTo(pageInput, navigationOptions)
    .then(
    function () {
    // Called when the dialog closes
    }
    ).catch(
    function (error) {
    // Handle error
    }
    );
     
    }
    Here is the Power FX code to get the GUID inside Power Apps.
     
    Set(RecordGUID, Text(GUID(Param("recordId"))));
     
    Set(RecordItem,
      If(IsBlank(Param("recordId")),
        First('Your Dataverse Table'),
        LookUp('Your Dataverse Table', 'Your Unique Identifier Column' = GUID(RecordGUID))
      )
    );

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard