cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gbrown
Frequent Visitor

Patching into a Customer Field From a Collection

Hi,

 

Working on a canvas app to create intersect records between the standard 'Accounts' entity and a custom 'Events' entity.  The intersect is called 'Event Participation'.  It is a manual N:N.  The record has a look-up field called "Event Participation ID", which is the ID of the Events record.  It also has an 'Attendee' field which is defined as a customer data type.  Originally we were accepting Account or Contact attendee information, but now it's all Accounts.  I have created a gallery that is populated by a collection of all Accounts.  This helps me avoid delegation issues and also to reshape the data by adding an 'IsChosen' field.  In the gallery, users can push a button on each row to send that row to the 'Events Participation' intersect and it works well.  The issue happens when they select multiple rows via the "IsChosen" check-box and I use that to do a 'ForAll' patch to the 'Events Participation.  Below are some screen shots of the app, and also the button's on-select code for the 'ForAll' patch.  Not sure what I'm doing wrong.  It will create a record in Events Participation for each selected row in the gallery, but doesn't set the Attendee.

 

Button's code:

ForAll(
Filter(
colAccountDat,
IsChosen
),
Patch(
[@'Events Participation'],
Defaults([@'Events Participation']),
{'Event Participation ID': [@ModelDrivenFormIntegration].Item},
{
Attendee: {
ID: colAccountDat.accountid,
Value: colAccountDat.name
}
}
)
)

 

Any help anyone could provide would be greatly appreciated.

 

EmbeddedCanvasApp.pngButtonForAllPatch.png

1 ACCEPTED SOLUTION

Accepted Solutions
gbrown
Frequent Visitor

I've solved this issue with some help from Shane Young and PowerApps911.  To achieve the patch, I take advantage of the new "As" functionality:

 

ForAll(Filter(AccountGallery.AllItems, gCheck.Value = true) As InRec,
Patch(
[@'Events Participation'],
Defaults([@'Events Participation']),
{
Attendee: InRec,
'Event Participation ID': [@ModelDrivenFormIntegration].Item
}
));

View solution in original post

2 REPLIES 2
gbrown
Frequent Visitor

I've solved this issue with some help from Shane Young and PowerApps911.  To achieve the patch, I take advantage of the new "As" functionality:

 

ForAll(Filter(AccountGallery.AllItems, gCheck.Value = true) As InRec,
Patch(
[@'Events Participation'],
Defaults([@'Events Participation']),
{
Attendee: InRec,
'Event Participation ID': [@ModelDrivenFormIntegration].Item
}
));

Many online software and applications are available which providing the best-written tips for collecting the customer fund. Most of the people get one of the best-written options on the britishessays.net site page which offers useful tips for students who want to get the best writing samples to complete any kind of writing work.

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.

Users online (1,422)