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 / Need help to nest 2 le...
Power Apps
Unanswered

Need help to nest 2 levels deep for Clone

(0) ShareShare
ReportReport
Posted on by 276

Need help with combining the below code into a single action.  Both work individually but from a user experience perspective, I need a single action.

Hierarchy of tables:

  • Facilities (1:many)
    • Assessment Event (1:many)
      • Assessment Tasks

The current code that works independently.  This does the Facilities and Assessment Events.

With(
 Patch(Facilities, Defaults(Facilities), {
 'Facility Name': "CLONE " & Self.Selected.Item.'Facility Name'
 })As ClonedFacility,
 ForAll(Self.Selected.Item.'Assessment Events', Patch('Assessment Events', Defaults('Assessment Events'), {
 AssessmentTitle: "CLONE " & AssessmentTitle,
 Facility: ClonedFacility
 })))

  What I need to have happen is then it also needs to clone the Assessment Tasks related to the Assessment Events.  This code works by itself but the missing piece for me is getting them nested into one action. 

With(ac
 Patch('Assessment Events', Defaults('Assessment Events'), {
 AssessmentTitle: "CLONE " & Self.Selected.Item.AssessmentTitle
 })As ClonedAssessmentEvent,
 ForAll(Self.Selected.Item.'Assessment Tasks', Patch('Assessment Tasks', Defaults('Assessment Tasks'), {
 'Assessment Event': ClonedAssessmentEvent,
 'Assessment Score': 'Assessment Score',
 AssessmentTask: AssessmentTask,
 Category: Category,
 Facility: Facility,
 'Methodology ': 'Methodology ',
 Sort: Sort,
 SubCategory: SubCategory
 })));
Notify("A copy of the selected Assessment Event, " & Self.Selected.Item.AssessmentTitle & ", has been created. Please open the record and update the necessary fields.")

 

Categories:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard