cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver II
Resolver II

Add New Records by combining two ID's from a SharePoint List into a 2nd SharePoint List

I'm not sure what is the most efficient syntax to do this - here is my scenario:

 

Thinking probably a Collect then Patch but not sure. Need help...

 

Here is the Code I have been developing but need someone to provide insight on this one:

 

For New Project Account:

Set(CurrentAcctID,ThisItem.ID); If(AcctMain, AcctType.Value = “Source” ,Collect(AcctMain, {ID: Value, AccountName: Value, AsToPri: Value}));

Patch(Collection2, {ID: CurrentAcctID&ID, MatchName: AccountName, MatchAsToPri: AsToPri.Value})

 

For New Source Account:  (only difference between the two is in the Patch function for the ID) 

Set(CurrentAcctID,ThisItem.ID); If(AcctMain, AcctType.Value = “Source” ,Collect(AcctMain, {ID: Value, AccountName: Value, AsToPri: Value}));

Patch(Collection2, {ID: ID&CurrentAcctID, MatchName: AccountName, MatchAsToPri: AsToPri.Value})

 

 

Scenario:

2 SharePoint List:   AcctMain with an AccountType of either Project or Source.

 

                               ProjectSourceMatch needs a record for every combination of the IDs for Project and Source Accounts.

 

                               (Example:  New Account in AccountMain list is a Project Type with an ID of 40 and 

                                                 Existing Account in AccountMain list is a Source Type with an ID of 12

                                                 Existing Account in AccountMain list is a Source Type with an ID of 18

                                                 I need to add new records in ProjectSourceMatch list with IDs of 4012 and 4018.

 

When a New Account is submitted a box will popup with an OnSelect control that will run the code to add the new records to the ProjectSourceMatch list.

 

 If the AccountType is a Project then new records will be needed for the combination of the Project ID and all of Source IDs. (Ex: Project ID = 40, Source IDs = 12,18,22,30 --  new record IDs 4012,4018,4022,4030)

 

If the AccountType is a Source then new records will be needed for the combination of the Source ID and all of Project IDs. (Ex: Source ID = 28, Project IDs = 3,9,14,25 --  new record IDs 328,928,1428,2528)

 

As can be seen in the examples, the ProjectID is always first when combining.

 

Thanks, Marc...

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver II
Resolver II

Re: Add New Records by combining two ID's from a SharePoint List into a 2nd SharePoint List

So far - I have solved the Collect side of my scenario and will repost for the Patch side if I am unable to solve for it.

 

View solution in original post

1 REPLY 1
Highlighted
Resolver II
Resolver II

Re: Add New Records by combining two ID's from a SharePoint List into a 2nd SharePoint List

So far - I have solved the Collect side of my scenario and will repost for the Patch side if I am unable to solve for it.

 

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,742)