Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Model Driven App Custom Pages, Passing multiple parameters

(0) ShareShare
ReportReport
Posted on by 467

Hello, I have built a custom page to compliment our Model App.  This application launches from the Main form or from a project record within our model application.  

 

The Architecture of the custom page (Canvas app) application requires the use of several screens and based upon a value on the Parent model app form (Project Record) a specific canvas page should load.  From all the documentation I have read the integration seems to be passing the model app recordid of the current record over to the canvas app and this makes a lot of sense.   Within your appstart once you have the record id you could in-turn perform a lookup of this record providing the values of the record resulting in additional logic such as if statements to determine the appropriate screen navigation.

 

Now if one were to switch over to the newer app.startscreen this seems to take on a different approach where if I can pass the parameter of the value that I would use for logic to drive the screen navigation we can achieve much quicker app loading times.

 

So what I am looking to do here is grab a value from the model app form, this form may not be saved yet, pass this value over to the custom page (Canvas App) which would allow for better use of the app.startscreen method for improved performance.

 

I was playing around with the javascript used for custom pages and it seems like you can hijack the record id however this is now the only value you are returning

recordId: Xrm.Page.data.entity.getId() - Default
 recordId: Xrm.Page.getControl(parameter).getName() - Tested and works
 
My goal here is to continue returning the recordid however return an additional parameter from the form without having to perform a lookup on the record id from the canvas app as it's highly possible the model form is not yet saved.
  • brownman311 Profile Picture
    brownman311 37 on at
    Re: Model Driven App Custom Pages, Passing multiple parameters

    Thanks for the tip @melamri! All of those quotes and commas were making my head spin...I found it easier to just use ParseJSON() to set them in my variables. Hope this helps the next dev!

     

    My recordID in JavaScript

    recordId: JSON.stringify({ firstParameter: varRecordId, secondParamter: varSourceControlName.toString() })

    PowerFx app.OnStart

    Set(varRecordOfFirstParameter,
     If(IsBlank(GUID(ParseJSON(Param("recordId")).firstParamter))),
     Blank(),
     LookUp(Clients, 'Client Id' = GUID(
     ParseJSON(Param("recordId")).firstParamter)) //get First parameter value from recordId
     )
    );
    
    Set(varSecondParam,
     If(IsBlank(Text(ParseJSON(Param("recordId")).secondParameter)),
     Blank(),
     Text(ParseJSON(Param("recordId")).secondParameter) //get the value of the second parameter
     )
    );

     

  • matt32 Profile Picture
    matt32 2 on at
    Re: Model Driven App Custom Pages, Passing multiple parameters

    Hi krishna9,

    I had the same problem but got it working by removing the JSON function in my canvas app, so my code was like this:

    Set(inputParameters, Param("recordId"));

  • NKC Profile Picture
    NKC on at
    Re: Model Driven App Custom Pages, Passing multiple parameters

    Hi,

    I tried above its not working. See below. Is there any workaround to pass multiple parameters from Dynamics 365. I am getting value into input parameters but match is not working. 

     

    Capture.PNG

  • meelamri Profile Picture
    meelamri 468 on at
    Re: Model Driven App Custom Pages, Passing multiple parameters

    Thank you for your feedback.
    On my side, the formula was working properly. It may be that things have changed in the meantime.

    In any case, this is a workaround until we have a more elegant way. Thank you once again!

  • Re: Model Driven App Custom Pages, Passing multiple parameters

    This was a smart workaround, thanks @melamri !

  • Re: Model Driven App Custom Pages, Passing multiple parameters

    You are correct, parsing of json is missing a few characters in melamri's post. In powerapps it should look like this: 

     

    arevsun_1-1657136090690.png

    I agree with you that it should have been easier sending multiple parameters to a canvas page. 

     

  • Dudditz Profile Picture
    Dudditz 467 on at
    Re: Model Driven App Custom Pages, Passing multiple parameters

    Hi melarmi, I actually tested out your post a few weeks ago and it seemed like the parsing was no longer working correctly.  I will try to rebuild this and see if it was something I did wrong at the time.  That said, this procedure is also setting global variables which are not compatible with the new app.startscreen however I am still interested in making this work as I have other projects that will require more than one parameter.   I find it odd that dynamically launching a screen within a custom page would require this level of work around.  I feel like I am missing something somewhere as passing a url parameter to a canvas app is common practice however how to do something similar with a custom page such as a value from a model app form.

  • meelamri Profile Picture
    meelamri 468 on at
    Re: Model Driven App Custom Pages, Passing multiple parameters

    Hi @Dudditz

     

    I managed to pass a JSON from the app to the custom page. I share all the details on my blog. I think it will help. 

    https://xrmtricks.com/2021/10/25/how-to-pass-an-object-from-a-model-driven-to-a-custom-page/

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard