Apologies for creating yet another post on this subject but MS's instructions on learn.microsoft.com are a little lacking.
I have a problem at the very first step that I cannot figure out.
App OnStart:
Set(AppID, "86d39419-1d42-4371-a036-825d0d07f0ad");
If(Not(IsBlank(Param("surveyId"))),Set(surveyId,Param("surveyId")));
Which seems incredibly straightforward. The Edit properties area at the top of the page shows no errors in this code. (No red underlining) but the right hand flyout that shows all of the properties has a red X above OnStart.
Starting the app and then stopping it to look at Variables on the left nav reveals that both AppID and surveyId are null. surveyId should be null at this point since it will be set either by the inbound url or when a user chooses a record on the browse page. But AppID should Set and it isn't.
I fixed the url generation with this:
Launch(
Concatenate(
"mailto:recipient@example.com?",
"subject=IBC%20Presurvey",
"&body=Here%20is%20a%20link%20to%20a%20PreSurvey: ",
"https://apps.powerapps.com/play/",
AppID,
"?surveyId=",
surveyVal.ID
)
)
But it's not pulling the right record.
I'm 99% sure the problem is in the DetailScreen1 OnVisible property which is this:
If(Not(IsBlank(surveyId)), UpdateContext({surveyVal:LookUp('BusMarket - IBC PreSurvey', ID = Value(surveyId))}))
But I don't understand what is wrong.
surveyId is getting passed correctly through the url. I can see it there.
Well, I solved it before I finished the reply. 🙂
Shouldn't have used the Value of surveyId.
If(Not(IsBlank(surveyId)), UpdateContext({surveyVal:LookUp('BusMarket - IBC PreSurvey', ID = surveyId)}))
Once again, thanks for following along. 😄
Ok, I'm right at the finish line but could use some help generating the Sendto command.
I don't want to use the O365 connector and want to use a basic Sendto and let the OS handle it.
MS provided example is:
Office365Outlook.SendEmailV2("Recipient", "Subject", "Here's the deep link to the selected account - https://apps.powerapps.com/play/{App ID}?accountId=" & accountVal.Account)
Which would translate to:
Office365Outlook.SendEmailV2("Recipient", "Subject", "Here's the deep link to the selected account - https://apps.powerapps.com/play/{AppID}?surveyId=" & surveyVal.ID)
for this app.
I converted to:
Launch("mailto:recipient@example.com?subject=This%20is%20a%20test&body=Here%20is%20a%20link%20to%20a%20checklist:%20-%20https://apps.powerapps.com/play/{AppID}?surveyId=%20&surveyVal.ID")
Which results in an email draft that looks like what I've attached.
I can see that the problem is with the {AppID} because that is where it stops being interpreted as part of the link and switches to basic text. And it's showing the text for the variable rather than the content of the variable.
I just have no clue how to solve.
Well... weirdness abounds. Publishing the current WIP version and then running it once as a 'user' rather than Play from the Edit page now sets both of those variables correctly.
If I had to guess, clicking Play in the Editor DOES NOT trigger the App OnStart event properly.
Stay tuned. I may solve this on my own yet.