cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Neryhumberto
Frequent Visitor

How to automatically assign a different user as owner each time the flow is executed

I need to assign as owner a record that is created in Dynamics to a user but when another record is created it is automatically assigned to another user.
I have no problem with assigning the record but I don't know how to do the even and odd sequence in the assignment to the two users.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: How to automatically assign a different user as owner each time the flow is executed

Hi @Neryhumberto,

 

The leadid field in the Dynamic 365 entity is a string, so you need to convert it into an integer, please use these expression:

mod(int(triggerBody()?['leadid']),2)

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
Super User
Super User

Re: How to automatically assign a different user as owner each time the flow is executed

Hi @Neryhumberto 

 

Not sure I understood your requirement. If you could please explain in an example that would be helpful.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Neryhumberto
Frequent Visitor

Re: How to automatically assign a different user as owner each time the flow is executed

When a lead is created in Dynamics 365, I want to assign this record to seller#1, so that when another lead is created assign to seller#2, and when another lead is created assign this record to seller#1 again, each time a record is created assign to the next seller.

 

I know how to assign a single record to a seller, but Microsoft Flow does not allow me to create two triggers in a flow.

 

Thanks

Community Support
Community Support

Re: How to automatically assign a different user as owner each time the flow is executed

Hi @Neryhumberto,

 

You can create two similar Flows, then create condition, then use the mod() function to get the mod of new created item's ID:

 

mod(triggerBody()?['ID'],2)

 

If one record created, the ID is even, the result of mod() function will be "1", or it will be "0". So the two similar Flows will continue according these results.

 

OR actually, you have no need to create multiple Flow, if you just create one Flow, you could create a Switch action to assign to different users according to result of mod() function.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Neryhumberto
Frequent Visitor

Re: How to automatically assign a different user as owner each time the flow is executed

Hi v-litu-msft, sorry I'm new on flow, 

What I am doing wrong?

 

flow1.png

flow2.png

flow3.png

Community Support
Community Support

Re: How to automatically assign a different user as owner each time the flow is executed

Hi @Neryhumberto,

 

The leadid field in the Dynamic 365 entity is a string, so you need to convert it into an integer, please use these expression:

mod(int(triggerBody()?['leadid']),2)

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: 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!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (8,187)