My power app needs to open to the homepage when first opened. If the person navigating the app is an admin, they should be taken to the admin review page. If the person navigating the app is a user, they should be taken to the request review page. I have SharePoint list with a column of names and emails. I have a collection and global variable to establish if someone is an admin (varIsAdmin).
On patch of a record, two emails are sent. One to the admin to prompt them to review/approve the submission and another to the user as confirmation of submission. Each email contains a link with the same url that, depending on the admin/user status of the person clicking the link, should take the admin to the admin review page and the user to the "review the request" page.
The issue with my current on start statement is that if the refid isn't specifically set to zero in the url, it takes the person to the admin page with no visible record. It should take them to the homepage.
https://apps.powerapps.com/play/e/[appurl]&source=portal&hidenavbar=true# (this url doesn't work and takes us to the admin page with no record visible)
vs
https://apps.powerapps.com/play/e/[appurl]&source=portal&refid=0&hidenavbar=true# (this url works by taking us to the homepage)
//Specific User view global variable
Set(
varUserEmail,
User().Email
);
//Admin Access Collection
Collect(
colAdmins,
'Capital Tool Assignee'
);
//Admin Access Global Variable
Set(
varIsAdmin,
If(
varUserEmail in colAdmins.Email,
true,
false
)
);
//Deep Link record specification global variable
Set(
varRecordID,
Value(Param("RefID"))
);
//If there is a record #, navigate to admin page if admin and user page if not an admin, otherwise go to homepage
If(
varRecordID <> 0 && !varIsAdmin,
Set(
varThisRecord,
LookUp(
CapitalToolRequests,
ID = varRecordID
)
) && Navigate(UserModifyRequestPage),
If(
varRecordID <> 0 && varIsAdmin,
Set(
varThisRecord,
LookUp(
CapitalToolRequests,
ID = varRecordID
)
) && Navigate(AdminModifyRequestPage),
Navigate(HomePage)
)
);
Any help would be appreciated. If I need to include more info, please let me know.