cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
donsvensen
Advocate I
Advocate I

Inserting x related records - model driven app

Hi

 

Hope that someone can help me to solve this.

 

I have a custom entity called promotion and a one2many relationship to an entity called Promotion2Products which has a relationship to the Product entity.

 

The customer now wants to be able to add all products with a specific brand or sub category to a promotion.

 

Should that be done via flow/powerautomate or canvas app or ?

 

I am using a model drive app now to create promotions and have a grid in the form for a promotion that lists all products in the promotion - and can add one product at a time using a quickcreate form.

 

Thx in advance

/Erik Svensen

2 ACCEPTED SOLUTIONS

Accepted Solutions
EricRegnier
Super User
Super User

Hi @donsvensen,

Good question and there are many schools of thought with no right or wrong solution in my opinion.

  • If you need to capture the brand or category the promotion relates to then Power Automate makes sense. You can add a lookup field on brand and/or category and have a flow that triggers when that field gets set (on create and update). The only tricky part is you'll need to manage when the brand/category changes. Should you clear existing products and reload? Or keep existing and just add new ones, etc
  • If you only need the ability to multi select and search products by brand/category which then associates them to your promotion then an embedded canvas app is a valid an option because model-driven apps doesn't support this out-of-the-box due to the custom N-N relationship (i.e. Promotion2Products) configured. 
  • You can use out-of-the-box N-N relationship to map promotions to products which would then allow you to associate/dissociate in bulk (i.e. by brand or category) but the user would to have to filter and select the products. The main disadvantage with out-of-the-box N-N relationship is that you can't have additional fields to the relationship; you're more restricted.
  • There are other options such as the following, but the base solution is similar to the ones above, the difference is more on the user experience side.
    Have a command bar button to add products by brand/category. Clicking the button can either open a canvas app (similar to the embedded app) or open quick create on a new entity named something like "Add Product Request". Upon create of "Add Product Request", triggers a flow that would then associate the products based on the request and then close the request by setting the status to complete.

I think these are the top options that come to mind besides taking the custom route.

Hope this helps!

 

View solution in original post

donsvensen
Advocate I
Advocate I

thx to @ben-thompson @EricRegnier for getting back and providing valuable solution ideas.

 

I decided to go with a canvas app and a N:N relationship.

 

donsvensen_0-1598625773455.png

And by using a combination of ForAll and Relate function the result turned out ok

 

Thx again for the support

View solution in original post

3 REPLIES 3
EricRegnier
Super User
Super User

Hi @donsvensen,

Good question and there are many schools of thought with no right or wrong solution in my opinion.

  • If you need to capture the brand or category the promotion relates to then Power Automate makes sense. You can add a lookup field on brand and/or category and have a flow that triggers when that field gets set (on create and update). The only tricky part is you'll need to manage when the brand/category changes. Should you clear existing products and reload? Or keep existing and just add new ones, etc
  • If you only need the ability to multi select and search products by brand/category which then associates them to your promotion then an embedded canvas app is a valid an option because model-driven apps doesn't support this out-of-the-box due to the custom N-N relationship (i.e. Promotion2Products) configured. 
  • You can use out-of-the-box N-N relationship to map promotions to products which would then allow you to associate/dissociate in bulk (i.e. by brand or category) but the user would to have to filter and select the products. The main disadvantage with out-of-the-box N-N relationship is that you can't have additional fields to the relationship; you're more restricted.
  • There are other options such as the following, but the base solution is similar to the ones above, the difference is more on the user experience side.
    Have a command bar button to add products by brand/category. Clicking the button can either open a canvas app (similar to the embedded app) or open quick create on a new entity named something like "Add Product Request". Upon create of "Add Product Request", triggers a flow that would then associate the products based on the request and then close the request by setting the status to complete.

I think these are the top options that come to mind besides taking the custom route.

Hope this helps!

 

ben-thompson
Memorable Member
Memorable Member

The other solution that Eric doesn't cover is using a PCF component to map the entities https://pcf.gallery/categories#many%20to%20many lists 3 possible options that may be suitable NN Checkboxes, N to N Multiselect and NN Tags

 

The advantage of using a PCF component is that you don't need to worry about a canvas app everything is done within the subgrid on the Product and Promotion forms and it should work both ways.

 

 

---
If this post has answered your question please consider it for "Accept as Solution" or if it has been helpful give it a "Thumbs Up".
donsvensen
Advocate I
Advocate I

thx to @ben-thompson @EricRegnier for getting back and providing valuable solution ideas.

 

I decided to go with a canvas app and a N:N relationship.

 

donsvensen_0-1598625773455.png

And by using a combination of ForAll and Relate function the result turned out ok

 

Thx again for the support

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (4,342)