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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update items in sp lis...
Power Apps
Unanswered

Update items in sp list with id from other sp list (primary key - foreign key relationship)

(0) ShareShare
ReportReport
Posted on by 58

I need urgent help!

 

I have two sharepoint lists:
SP List 1: Skills (Relationship: clear data)
ID: Primary Key
Title: Text
Provider: Text
Approval Status: Automatically
Keywords: multiple choice column

 

SP List 2: Skills Employees (Relationship: many data)
RefID: Foreign Key, Number
Title: Text
Provider: Text
level: text
NameEmployee: Person
email: body
Team: Text

 

I only transfer title, provider and keywords

I would like that if I change something in the Skills list using Powerapps, that it will also be changed in the Skills Employees list (Relationship 1:n).

I've tried Updateif, Patch, Collections...it just doesn't work...

How do I get one list to notice that the primary key in sp list 1 is the same as in sp list 2??? 

 

Thanks for any help

 

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Masakichi123 , you can use Patch. For example:

     

    Patch(
     Skills,
     LookUp(
     Skills,
     ID = Gallery1.Selected.ID
     ),
     {
     Title: "Something",
     Provider: "Something",
     Keywords: "Something",
     'Approval Status': "Something"
    
     }
    );
    Patch(
     'Skills Employees',
     LookUp(
     'Skills Employees',
     RefID = Gallery1.Selected.ID
     ),
     {
     Title: "Something",
     Provider: "Something",
    	Keywords: "Something"
     }
    )
    

     

     

     

    If you're saving data to the Skills list using SubmitForm, you can apply similar logic to the OnSuccess property of the Form to Patch the Skills Employees list. E.g.:

     

    Set(
     varRecord,
     Self.LastSubmit
    );
    Patch(
     'Skills Employees',
     LookUp(
     'Skills Employees',
     RefID = varRecord.ID
     ),
     {
     Title: "Something",
     Provider: "Something",
    	Keywords: "Something"
     }
    )
    

     

     

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

     

     

  • PowerNuggets Profile Picture
    360 on at

    Hi @Masakichi123 

     

    You can use lookup value in the second list to hold the ID of the record from the first list to have 1:N relationship, then use a flow to fetch all records related  details from the second list

     

    Below video may help

    https://www.youtube.com/watch?v=KYsMNoc7aPY

     

     


    _____________________________________________________________________________________
    Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.

     

    MD

  • Masakichi123 Profile Picture
    58 on at

    Hi @Amik ,

     

    thanks for your help. 

    It works partially; now a change is made to the employee skills for a value. If there are multiple values in the Skills Employee List, then only the first one will be adjusted and the others will remain unchanged.

    What can I do to change all the values that are found?

    Thanks a lot in advance!

     

  • Masakichi123 Profile Picture
    58 on at

    Does it possibly work with "ForAll" or with "Filter"?

  • Verified answer
    Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Masakichi123 that's a very different question. If you want to update List 2 based on multiple changes to List 1, I would suggest using Power Automate to achieve this as @PowerNuggets rightly suggested.

     

    Power Automate Solution: https://www.youtube.com/watch?v=looyVm_8OKI 

     

    To achieve this in Power Fx, you would need an expression like below. However, I find this unnecessarily complicated given Power Automate can achieve this simply and faster.

     

    With(//produce a filtered table of records in the parent table only where a child record does exist
     {
     _parents_with_child: Filter(
     AddColumns(
     Skills,
     "child_ID",
     LookUp(
     'Skills Employees',
     RelatedID = Skills[@ID],
     RelatedID
     )
     ),
     !IsBlank(child_ID)
     )
     },
     ForAll(
     _parents_with_child,
     UpdateIf(
     'Skills Employees',
     RelatedID = _parents_with_child[@ID],
     {
     Title: _parents_with_child[@Title],
    		Title: _parents_with_child[@Provider],
    		Title: _parents_with_child[@Keywords]
     }
     )
     )
    )

     

     

     

    ------------------------------------------------------------------------------------------------------------------------------

     

    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

    Imran-Ami Khan

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard