Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Unanswered

How to integrate a Canvas or Model driven app with Mpos/Cpos

Posted on by 70

How to integrate a Canvas or Model driven app with Mpos/Cpos?

We know it's possible to add a button to the POS with which we can launch a website. So it will be possible to launch a model drive app or a canvas app. We even could distinguish different apps per role and show/hide buttons based on the role of the signed in worker.

However the authentication to the power apps is done based on the D365 account. Is there a way to enforce a sign in to the powerapp when the worker at the pos differs from the last log in on the power app? This to prevent users starting apps to which they should not have access. Basically when a worker signs off from the register all the sessions in the power app on that device should be signed off.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to integrate a Canvas or Model driven app with Mpos/Cpos

    I'm no expert but suggestions.

    If you aim to do this without any customization I can only think of one thing. Change the URL to be the Sign out URL with a redirect to your App. Everytime a user would be clicking any of the buttons they would be sent to the sign out page first. It's not a solve all or good solution as it could be the same user trying to open the app a second time.

    An example of this is how when you activate a CPOS you get sent to the sign out page and then sent back to the CPOS afterwards. I can't guarantee it will work, because there are limits on how you can redirect after a sign out.

    If you want to consider customizations. You could have a PreOpenUrlTrigger. The options value provided includes the URI trying to be opened and this way you can tell if you need to have logic verifying the user or not.

    For the verification scenario I would put a static variable on the class that holds the currently signed in user or an empty string if no actions have been taken yet.

    There are two ways to handle the sign out. Either attempt to use code to open the sign out page in a new window. Or force the user to press a separate button called sign out that have the correct uri.

    If you go with a separate button then the first thing you need to do is send a message to the user and then cancel the operation with the return response. Once the user press the sign out button you can then set the variable to "Signed out". When a user later press a button for model driven app set the variable to the worker id (As long as the previous value was Signed out).

    If the user closes the pos then the variable value is lost. So a newly instantiated value should not be "Signed out" as you want to enforce a sign out incase the pos was closed while a user was signed in.

    While you can force the user to use the "sign out button" this way, this will not enforce that the sign out is successful. Afterall you have no data back from the browser that the button open.

    I hope this could be somewhat useful to you and finding a way forward.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans