cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

How to assign ownership of record from User email

I'm trying to create a new task for a user as defined in an excel table, with the users email address.

 

I'm having difficulty getting setting the owner useing Create a New Record. The below gives a 404 error:

"systemuser With Id = 7a61d442-27a6-4196-8f7a-80e0aecb1471 Does Not Exist"

 

Power_Apps.png

I know the user exists (in this case it is me), the 'Get user profile' step returns the correct record.

 

I have tried not defining the owner type, but that gives a differnt error. I have also tried useing create record in CDS  with the same result.

 

All help appreciated. Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: How to assign ownership of record from User email

@mrpowergage 

No problem at all.  So, the unique identifiers for Office 365 won't be the same as for D365, so using the ID field from your "Get User Profile" won't translate...it won't find a match.  The fix is to find something the two have in common, like the email address, to help link it.  If you are only using the Get User Profile step to get the ID (not using other bits), then you can probably get rid of it and replace it with the Common Data Service (CDS) step below:

20200115c.PNG

 

Here, I am asking CDS to list all the records where the internalemailaddress matches the email address from my trigger.  You can replace that with the email address for the Dynamics user you need the ID for (don't forget the single quotes).

 

Then, in the Create Record Step, you would use the "User" field from the List Records as the ID in the Owner field, and that should give you the correct result.

20200115d.PNG

 

Note, that because Power Automate is expecting multiple results from the "List Records" step (even though there should be only one match), it will want to put the next step in an Apply to Each loop.  The way around this is to use First() to let it know you only want 1 element of the expected Array.   Check out Elaiza Benitez' video on that here.

 

You're very close, keep at it 🙂

Keep us posted.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

Re: How to assign ownership of record from User email

@mrpowergage 

Hi there.  So, the GUIDs used in Office 365 don't correlate to the ones used in D365.  You'll want to add an interim step to get the user record, maybe using their email address, and use that ID as the owner in your create a record step.

 

Also, have you already considered using the CDS connector vs. the D365 connector?  It will give your flow additional functionality as well as longevity.

 

Hope this helps, keep us posted.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Highlighted
Helper II
Helper II

Re: How to assign ownership of record from User email

Thanks @edgonzales 

 

Forgive me if this is obviouse: please could you clarify what you have in mind for this "an interim step to get the user record, maybe using their email address, and use that ID as the owner in your create a record step."

 

I have the dynamics user email, what step can I use that to get their GUID?

 

Thanks for the advice re CDS connector, I'll use that.

Highlighted
Helper II
Helper II

Re: How to assign ownership of record from User email

@edgonzalesI think I've solved my question. This is my solution, was it the sort of thing you had in mind?:

 

Power_Apps.png

Highlighted
Super User II
Super User II

Re: How to assign ownership of record from User email

@mrpowergage 

No problem at all.  So, the unique identifiers for Office 365 won't be the same as for D365, so using the ID field from your "Get User Profile" won't translate...it won't find a match.  The fix is to find something the two have in common, like the email address, to help link it.  If you are only using the Get User Profile step to get the ID (not using other bits), then you can probably get rid of it and replace it with the Common Data Service (CDS) step below:

20200115c.PNG

 

Here, I am asking CDS to list all the records where the internalemailaddress matches the email address from my trigger.  You can replace that with the email address for the Dynamics user you need the ID for (don't forget the single quotes).

 

Then, in the Create Record Step, you would use the "User" field from the List Records as the ID in the Owner field, and that should give you the correct result.

20200115d.PNG

 

Note, that because Power Automate is expecting multiple results from the "List Records" step (even though there should be only one match), it will want to put the next step in an Apply to Each loop.  The way around this is to use First() to let it know you only want 1 element of the expected Array.   Check out Elaiza Benitez' video on that here.

 

You're very close, keep at it 🙂

Keep us posted.

-Ed-

 

If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

Highlighted
Super User II
Super User II

Re: How to assign ownership of record from User email

The perfect solution is the one that works, right?  Great job!

 

So, you may notice that this one might be a bit slow because it will go through all of the user records one at a time before completing.  If that's not an issue, then you're golden.  If it turns into a thing, then check out my version above.  As long as it's working for you, then we're all stoked! 🙂

 

Well done!

-Ed-

 

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (5,234)