Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Updating DataSet content for many to many relationship subgrid

(1) ShareShare
ReportReport
Posted on by 113 Most Valuable Professional

Hi,

I'm trying to create a control that will among other feature allow to display related records in a many to many relationship. This part is working great.

Now, I would like my control to be able to associate new records or disassociate existing records. I don't see at all how to achieve this.

What I am missing so far:

  • A way to find the primary record id
  • A way to associate/disassociate record. context.WebApi does not expose associate/disassociate messages and it is even not possible to get the name of the relationship

Thanks for your help

  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at
    Re: Updating DataSet content for many to many relationship subgrid

    bumping to see if there is any progress on these two requests:

    - adding relationship name in context

    - exposing execute method for the webapi

  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at
    Re: Updating DataSet content for many to many relationship subgrid

    Thank you for these explanation

     

    Any chance you add the relationship name in the context? And add the method Execute in the typing file?

  • AnqiChen Profile Picture
    on at
    Re: Updating DataSet content for many to many relationship subgrid

    hi Tanguy,

     

    I am sorry that I misunderstand your question. Regarding the ask:

    - provide the relationship name for a dataset

       Yes, we do not provide relationship name for a dataset to the control. A work-around is that a control could have a static input string property and when configured that control, customizer could fill in the relationship name

     

    - expose at least the Execute method of the web api so that we can build our own call to associate/disassociate records,

    Hopefully this helps

     

    Anqi

     

     

  • Tanguy TOUZARD Profile Picture
    113 Most Valuable Professional on at
    Re: Updating DataSet content for many to many relationship subgrid
    Hi Anqi,
    Unfortunately, it does not answer my question.
    It’s not about how I should change/adapt customizations to fit what PCF can handle. What users/customers will expect is that they can transform their NN subgrid (that allows associate/disassociate) with another layout but with same capability.

    My scenario is a simple tagging scenario. I have 10 tags, I want to display all of them as checkboxes. Ticking a checkbox will associate record. Unticking will disassociate record.

    With the least effort I can imagine, PCF should:
    - provide the relationship name for a dataset
    - expose at least the Execute method of the web api so that we can build our own call to associate/disassociate records, like described by Scott Durow: https://github.com/scottdurow/PowerApps-Samples/blob/model-driven-app-webapi/cds/webapi/ts-model-driven-app/src/test/Relationships/One-to-Many%20using%20execute.ts

    Is this something I can expect to be implemented? If not, I would really encourage you to document this as a limitation of PCF.
  • AnqiChen Profile Picture
    on at
    Re: Updating DataSet content for many to many relationship subgrid

    hi Tanguy,

     

    Suppose there is an entity 'Teacher', and an entity 'Student' is of N:N relationship. The way Dynamics does is internally creating a internal entity, entity name could be checked in 'Customization->Entity->Teacher->N:N relationship', let say the entityname is 'Courses'.

     

    This internal entity has associated teacherid, studentid, and its own 'Courses' entity record id.

    Regarding your question on how to associate/disassociate, ideally, it should be use webAPI to create/delete record in this 'Courses' table.

     

    The problem is that it seems webAPI is not able to CRUD on this internal entity, if that's the case, what we suggested is that you create an explicit entity 'Courses' table, with keys like 'CourseId', 'TeacherId','StudentId'. Then Teacher:Courses is 1:N, Student:Course is 1:N, and Teacher:Student is N:N.

     

    Then if you need to associate/disassociat Teacher:Student relationship, it's just CRUD on this 'Course' entity.

     

    Now it comes to another question, at a page Teacher, with related Courses subgrid, how do we associate a student. It should be, your subgrid dataset control, its manifest has two <data-set>s

    <data-set> //bind to entity courses

    <data-set> // bind to entity students

    The 2nd <data-set> is used to retrieve all candidate students and let user to pick one. As you already have page TeacherId, you have StudentId when user picked, you should be able to use webAPI to create a new Course record.

     

    Hopefully it makes sense to you

     

    Anqi

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard