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
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
)
);
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"));
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.
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!
This was a smart workaround, thanks @melamri !
You are correct, parsing of json is missing a few characters in melamri's post. In powerapps it should look like this:
I agree with you that it should have been easier sending multiple parameters to a canvas page.
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.
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/