I am currently trying to build a Canvas App for my users to create multiple quote products at once. The idea is as follows:
- Gallery1 is a list of all Products in the system
- ProductSearch is a text input to filter the products based on name/sku
- ProductList is a collection of all selected products
- Gallery2 is a list of all selected products, so a user may build their collection and visualize the products they've added.
- Button1 will be used after the user has selected the required products, and will create quote products for the quote that this app is embedded on.
I am currently stuck at the last step, as my ForAll loop and Patch function are not linking the new quote products with the selected product for their row. I can't seem to get the Product record from Gallery1/collection and put that into each new, unique quote product. My formula is as follows:
ForAll(Gallery2.AllItems,
Patch([@'Quote Products'],
Defaults([@'Quote Products']),
{producttypecode:[@'Product Type'].Product},
{quantity:1},
{quotedetailname:Title4.Text},
{propertyconfigurationstatus:'Properties Configuration'.'Not Configured'},
{quoteid:ModelDrivenFormIntegration.Item},
{productid:LookUp([@Products], Name in ProductList.Name)},
{uomid:'Default Unit'}
)
)
I have tried using First( and LookUp( to match productid with the product selected in the collection, but it either fails to match via a lookup, or uses the first product in the collection to populate all subsequent quote products.
I believe I am missing the correct lookup/relation function to attach my new quote products to the existing product, but I can't seem to figure it out. Any help would be appreciated.