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:
Thanks for your help
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
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
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Features releasing from October 2019 through March 2020
The largest Power BI, Power Platform, and Data conference in New Zealand