Hello,
I have came across scenario where I need to update SharePoint list mutiuser field called "InterestedIn".
Here multiple users can register their interests in particular list item using a button which says "I am interested"
on this button I need to add/append current user to the list column "InterestedIn"
Below is my code on button click, some how i need to add current user to existing users in columns and then Patch()
Patch(
GrabOpp,
galOpenOpportunities.Selected,
{
InterestedIn:Table(
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:"",
Picture:""
})
}
)
Thanks. 🙂
Solved! Go to Solution.
If any one reading this, I have found solution to this,
using Collection:
Step 1: Collect all existing users in collection:
Collect(InterestedUsers,galOpenOpportunities.Selected.InterestedIn)
Step 2: Add new user to Collection:
Collect(
InterestedUsers,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:""
}
);
Step 3: Now Patch the updated collection directly in Patch() function.
Patch(
GrabOpp,
galOpenOpportunities.Selected,
{
InterestedIn:InterestedUsers
}
)
Bingo.. 🙂
Does anyone know ?
If any one reading this, I have found solution to this,
using Collection:
Step 1: Collect all existing users in collection:
Collect(InterestedUsers,galOpenOpportunities.Selected.InterestedIn)
Step 2: Add new user to Collection:
Collect(
InterestedUsers,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:""
}
);
Step 3: Now Patch the updated collection directly in Patch() function.
Patch(
GrabOpp,
galOpenOpportunities.Selected,
{
InterestedIn:InterestedUsers
}
)
Bingo.. 🙂
This is not working for me. whenever I'm trying to update it always update the current users and remove the previous user.
Collect(InterestedUsers,Events.AcceptedBy);
Collect(InterestedUsers,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & User().Email,
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:"",
Picture:""
});
Patch(Events,First(Filter(Events,ID=ThisItem.ID)),{AcceptedBy:InterestedUsers})
Note:
AcceptedBy is the multi valued person column
Events is the list name
Thanks a lot! This was a quick and elegant solution!
I want to patch not only the first element of a filtered collection.
How can I patch every Phonenumber which is "" to "9-999-999-9999" - so we can sort the collection by phonenumbers a bit better?
In my special case I have a table of orders and want to sort by next estimated delivery date, but dates are sometimes empty and will be always on top when sorting.
I already tried:
//changes only first row of the filter:
Patch( Customers, First( Filter( Customers, Phone = "" ) ), { Phone: "9-999-999-9999" } )
//having syntax error:
Patch( Customers, Filter( Customers, Phone = "" ), { Phone: "9-999-999-9999" } )
You may try something like this: ForAll(Filter( Customers, Phone = "" ),Patch(Customers,ThisRecord,{ Phone: "9-999-999-9999" })
thanks a lot - this works.
this works, but makes my powerapps hanging off for a few minutes every time it is running 😞
function: yes
performance: really bad
user acceptance: NOOO!
are there other - more performant - solutions for this?
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
195 | |
69 | |
50 | |
39 | |
30 |
User | Count |
---|---|
248 | |
112 | |
95 | |
91 | |
72 |