cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sdmikejr
Level: Powered On

Related Items from 2 lists in SPO

Scenario: I have two lists in SPO. The relationship of the lists is one to many.

The "one" side I will refer to as List 1, the field with unique items is Products.

The "many" side I will refer to as list 2, the field with unique items is Accessories.

One Product can have multiple accessories.

 

The application is for users to look up a product and see what accessories each product has.

To do this, a user begins at the Product Gallery Screen and search for a given product. Once found, a user will select the product and then taken to the Accessory Gallery Screen. Here, they can see all related accessories for the selected product. If there is a new accessory, I have added an "Add Accessory" button which takes users to the New Accessory Screen.

Testing everything works great and I can add new accessories. However, when I go to the Product Gallery Screen and click on the product I just added the Accessory to, I am not seeing the new Accessory on the Accessory Gallery Screen. 

If I look in SharePoint it on the Accessory List it is showing the linked Product. 

After reading several other posts, it appears SharePoint is lacking in this linking. 

 

What I have done that is working but is a manual approach, is to make a ProductID field in the Accessory List (as a number data type) and manually copy the ProductID from the Product list each time I create a new Accessory.

I have tried to make the default value of ProductID to pull in the 'Product:ID' but this does nothing.

My question is, is there a way to have this number generated automatically through Flow or in PowerApps? Or is there a way to do this through formulas?

 

Any help would be greatly appreciated.

 

 

1 REPLY 1
Super User
Super User

Re: Related Items from 2 lists in SPO

I do this alot in my applications - sometimes I have more than one field for which I need to store the key of the related item.  In my example I have a Department list (equivalent to your product) and a Project list (equivalent to your accessories).  On the Project list, I have a DepartmentName column.  On my edit form, I include DepartmentName with the Visible proprty set to false. I use a Global Variable Dept to pass the Department between screens.   In the Default property of the DepartmentName data card I have the following forumula:

 

If(EditProject.Mode = FormMode.New, {
'@odata.type' : "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: LookUp(Department,Title=Dept).ID,
Value: Dept
}, ThisItem.DepartmentName)

 

As I get deeper into my app, I do this to set both Department and Project on, for example, a Milestone list or Next Steps list.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,882)