cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jwinega4
Regular Visitor

Modifying Multiple SharePoint Lists from One List Item

Hypothetically, I have two SP lists (this is a very simplified version of what I'm actually using) - a list of ongoing projects, and a list of available resources to assign to those projects. In the ongoing projects list, I have a multi-value lookup column for "Resources", and this pulls items from the other list.

 

Projects:

 

Project NumberAssigned Resources
1A, B
2C
3 

Resources:

 

 

Resource Name Resource TypeAssigned Project
ALarge Truck1
BSmall Truck1
CClown Car2

 

The Projects list has a custom PowerApps form that filters the resources available to select based on whether they are already assigned, to prevent selecting the same resource twice. Currently, I have a recurring Flow set up to periodically update the Resources list with the assigned project, as selected in the Project list. This makes it difficult in case a resource is selected, then accidentally unselected - it will not be available for re-selection until the Flow runs, or if the user manually changes the project assignment. Is there any way for PowerApps (either in the custom form, or in a Canvas App) to automatically update the resource list with the assigned project, as the values are selected? I suppose more importantly - is there a way for PowerApps to remove the assigned project value, if a resource is un-selected?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @jwinega4 ,

Is the 'Assigned Resource' column a multi-value lookup column in your Projects List?

Do you want to grab the IDs of the any items that had been "unselected" within your ComboBox?

 

If you want to grab the IDs of the any items that had been "unselected" within your ComboBox, please try the following workaround:

8.JPG

Set the OnChange property of the ComboBox in the Edit form to following:

Clear(UnselectOptions);
ForAll(
       ThisItem.'Trip Status',
       If(
           Not(Value in DataCardValue14.SelectedItems.Value),
           Collect(UnselectOptions, Value)
       )
)

On your side, you should set the OnChange property of the Assigned Resources ComboBox to following:

Clear(UnselectOptions);
ForAll(
       ThisItem.'Assigned Resources',
       If(
           Not(Value in AssignedResourcesComboBox.SelectedItems.Value),
           Collect(UnselectOptions, Value)
       )
);
// use Patch function to remove the assigned project value for current Project Item in your Resources List
ForAll(
       UnselectOptions,
       Patch(
             'Resources List',
             LookUp('Resources List', 'Resource Name' = Value),
             {
               'Assigned Project': Blank()
             }
       )
)

Note: I assume that each Resource Item could only be assigned to single one Project Item.

 

Please try above solution, check if the issue is solved.

 

Regards,

Community Support Team _ Kris Dai
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

2 REPLIES 2
jwinega4
Regular Visitor

Some extra info is probably needed here:

 

In both the custom PowerApps Sharepoint form, and in a Canvas app I have built over the project list for ease of phone use by certain end users, the "resource" selection is a ComboBox.  My thought is, in the OnChange property of the ComboBox, to use a filter function on the relevant SP list and a patch function to make the changes - but I can't see where I'd be able to grab the IDs of the any items that had been "unselected" to change them back to unassigned, only any additional selections made.

v-xida-msft
Community Support
Community Support

Hi @jwinega4 ,

Is the 'Assigned Resource' column a multi-value lookup column in your Projects List?

Do you want to grab the IDs of the any items that had been "unselected" within your ComboBox?

 

If you want to grab the IDs of the any items that had been "unselected" within your ComboBox, please try the following workaround:

8.JPG

Set the OnChange property of the ComboBox in the Edit form to following:

Clear(UnselectOptions);
ForAll(
       ThisItem.'Trip Status',
       If(
           Not(Value in DataCardValue14.SelectedItems.Value),
           Collect(UnselectOptions, Value)
       )
)

On your side, you should set the OnChange property of the Assigned Resources ComboBox to following:

Clear(UnselectOptions);
ForAll(
       ThisItem.'Assigned Resources',
       If(
           Not(Value in AssignedResourcesComboBox.SelectedItems.Value),
           Collect(UnselectOptions, Value)
       )
);
// use Patch function to remove the assigned project value for current Project Item in your Resources List
ForAll(
       UnselectOptions,
       Patch(
             'Resources List',
             LookUp('Resources List', 'Resource Name' = Value),
             {
               'Assigned Project': Blank()
             }
       )
)

Note: I assume that each Resource Item could only be assigned to single one Project Item.

 

Please try above solution, check if the issue is solved.

 

Regards,

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

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,127)