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 / Update a column in a C...
Power Apps
Answered

Update a column in a Collection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I'm trying to assign the value of my MasterID for all items of my collection at the moment I patch my collection data in my SharePoint list.
But I don't know how I should proceed.

 

This is the code I save data to my list:

 

 

SubmitForm(SharePointForm1);;
If(
 CountRows(CollectionObjUp) > 0;
 Patch(
 'Plantilla Objetivos';
 CollectionObjUp
 )
);;
Clear(CollectionObjUp)

 

 

Maybe can be done using some kind of "Update" function for change the value of my columns?

 

 

SubmitForm(SharePointForm1);;
Update(CollectionObjUp;MasterID=SharePointForm1.LastSubmit.ID);;
If(
 CountRows(CollectionObjUp) > 0;
 Patch(
 'Plantilla Objetivos';
 CollectionObjUp
 )
);;
Clear(CollectionObjUp)

 

 

 Many thanks in advance,

Marina.

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous you can use the UpdateIf function.

    It would be better to move all the code you have after the SubmitForm() to the OnSuccess of SharePointForm1.

    Your formula will be,

    If(CountRows(CollectionObjUp) > 0;
     UpdateIf(CollectionObjUp;true;{MasterID:SharePointForm1.LastSubmit.ID});;
     Patch(
     'Plantilla Objetivos';
     CollectionObjUp
     )
    );;
    Clear(CollectionObjUp)

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    @Anonymous You can also try 

    ForAll( CollectionObjUp As collection,collection.MasterID=SharePointForm1.LastSubmit.ID);;

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Did it work?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi,

    It didn't. 

    It keeps the MasterID = 1, it does not change to the ID value of my master list.

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Can you show me the code and also the contents of CollectionObjUp after the code runs.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This is my form screen:

    marinadengra9_0-1627645844441.png

    Once I save, (So SharePointForm1 Success, with the code you provided me), my second list looks as follows:

    marinadengra9_1-1627645939301.png

    MasterID always keeps 1.

    What I want is save the items with the ID of my Master Form/List.

     

    Many thanks for your help.

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous Display the value of SharePointForm1.LastSubmit.ID in a Label and see what it is.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    It keeps in blank, just when I press save it shows the same number as "SharepointIntegration.SelectedListItemID" but only for a milliseconds. 

    marinadengra9_1-1627648037995.png

     

    After saving, I enter again to the item list and then it shows the ID of my master list as is shown:

    marinadengra9_2-1627648202408.png

    But in my 'Plantilla Objetivos' list the items are saved with MasterID = 1.

    marinadengra9_3-1627648253367.png

     

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Anonymous If SharePointForm1.LastSubmit.ID is returning a null something went wrong with the Submit. You need to sort out that first.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard