web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching a list based ...
Power Apps
Answered

Patching a list based off changes to another list from changes to another list

(0) ShareShare
ReportReport
Posted on by 1,088

Hi this may be a bit confusing so ask me questions if needed.

 

I have three SharePoint lists.

 

Sales Person

Opportunity

Product

 

On the Opportunity list is a column that ties it to the sales person and on the Product there is a column that ties it to the Opportunity, but there is no direct column on product tying it to the Sales Person.

 

Sales person also has a column called Active (yes/no)

Opportunity has a column called Open (yes/no)

Product has a column called Available (yes/no)

 

What I want to do is when a sales person is marked as no longer active, I want the associated opportunities to be marked as not open and the associated products to those opportunities to be marked not available.

 

So using UpdateIf I am able to easily update the opportunities to the correct status when the sales person toggle changes in Power Apps, but I'm having a challenge figuring out how to then also update the products associated to the opportunities.

 

Here's my code for updating the opportunities when the sales person changes to not active (datacardvalue104), again this works, ...  just need help then updating the products tied to any changed opportunities.

 

If(
 DataCardValue104.Value = false,
 UpdateIf(
 Opportunities,
 'Account Manager'.DisplayName = Gal_AMs.Selected.Name.DisplayName,
 {
 CloseDate: Now(),
 Open: false
 }
 ),
 false
 )

 

Maybe create an array or something of the IDs for the Opportunities that were updated?? Or is there something else I can do?

 

Thanks,

Terry

Categories:
  • notj Profile Picture
    782 on at

    I don't know what the column name is for the products on the Opportunity list but it seems like you could duplicate your code for it. Perhaps I'm misunderstanding your structure.

     

     

     

     UpdateIf(
     Products,
     OPPORTUNITYCOLUMNNAME = INACTIVERPERSON.OPPORTUNITYCOLUMN,
     {
    DO THE THING HERE
     }

     

     

      

    Or something like: 

    ClearCollect(ProductstoUpdate, Filter(Products, OPPORTUNITYCOLUMN='Sales Person'.IDOFINACTIVEPERSON.OPPORTUNITY))

    Then you operate on the collection.

  • Mattw112b Profile Picture
    1,088 on at

    thanks for the reply.  I dont think the Updateif you suggest would work since there's no way to tie it from product to sales person, but I do think the collection would probably work.  I'm going to give that a try.

     

    Also just as fyi basic structure for connections is this:

    Mattw112IG_0-1610663851368.png

    Thanks,

    Terry

  • Verified answer
    WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @Mattw112IG ,

    I am assuming some field names here you will need to change, but this structure should do the job for you

    If(
     DataCardValue104.Value = false,
     UpdateIf(
     Opportunities,
     'Account Manager'.DisplayName = Gal_AMs.Selected.Name.DisplayName,
     {
     CloseDate: Now(),
     Open: false
     }
     );
     With(
     {
     wID,
     Lookup(
     Opportunities,
     'Account Manager'.DisplayName = Gal_AMs.Selected.Name.DisplayName
     ).YourSalesPersonIDName
     },
     UpdateIf(
     Product,
     'OPP ID' = wID,
     {
     //Your fields in here
     }
     )
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • WarrenBelz Profile Picture
    156,921 Most Valuable Professional on at

    Hi @Mattw112IG ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard