Hi all,
My portal is an commerce website. and i have 3 main entities in my workflow: contact,product, and order.
I want the workflow to create an order when someone signs into the portal.
Can someone give me an explanation on how to call the action/portal on my portal?
Hi @Verceti87 ,
supported calls to custom actions are a planned feature: https://docs.microsoft.com/en-us/power-platform-release-plan/2021wave2/power-apps-portals/portals-we...
The problem is the moment, when to trigger that action. Actually you do not know, when the user signs in. There is a field called last login or something like that on the contact. This field could be used to trigger it (when it works) unfortunately you will not know, for which site the user logged in and i am afraid that this is only set (if at all) when using local accounts.
What i would do is: create a lookup on the contact pointing to the order you want to create (really orders??). You could check in liquid, whether this field is filled and if not, create via the webapi a new order (or whatever) or redirect the user vbia js to a new order creation. You could also add a kind of triggerfield to the contact which is used by your workflow to trigger your action.
What my colleagues and i do is using a virtaul entity ( https://docs.microsoft.com/en-us/powerapps/developer/data-platform/virtual-entities/get-started-ve ) as a custom action trigger. Its really ugly but works. When you select from that virtual entity you could pass in the contact as a parameter and this virtaul entity could read the whereclause and put the contactid to the workflow/custom action you are using and return the id of the generated order.
Unfortunately i can not share the code as it is closed source from the company, but you get the idea. This is an adaequte replacement as long as custom actions are not working. You do not need to use virtual entities but doing so enables you to create the stuff also via liquid which brings the whole process to the backend.
Hope this helps,
Christian
PS do you really want to create something after login? I mean, this could produce a lot of dead tableentries for you. Just a question.
PPS may be @ragavanrajan or @OOlashyn have an idea how to trigger something upon login, they are really helpful
Thanks for your response. All im trying to do is associate a single active order to the user currently logged into the portal. I will look into the virtual entities...
Hi @Verceti87
You can use virtual entities as @chleverenz mentioned. Probably for more advanced scenarios. You can try the following method with the help of power automate. When the user login to the portal using Azure AD or local it is possible to capture the entry and associate a record to a different entity.
Here are the steps.
In Power Automate:
1. Select dataverse trigger ( Screenshot below) (When a row is added, modified or deleted).
2. Adding the flow steps below for your reference. (All marked boxes are important)
Basically, the idea here is to create a relationship to your product and order entity from the contact table.
In the above screenshot change, the red highlighted your product or order entity.
Note: This will work. When the user logins to the portal and when they fill the profile page and press the "update" button.
Hope it helps.
------------
If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
Hi @Verceti87 ,
If you don't mind that user, when login will be redirected to profile page each time what you can do, is to add js to the profile page and use Web API to create your order. Using a virtual entity is a cool idea as well (kudos @chleverenz). If you are using an external login provider and doing some claims mapping (ie external id or email) what you can do is to run a sync plugin on the update operation and perform your operation there. I was using a similar approach when we needed to assign a contact record on login to a different account ( as in that case there were multiple) based on the provided claim. Similarly to @chleverenz I cannot share the code but I think I explain it in enough detail.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
8 | |
3 | |
2 | |
1 | |
1 |