Managing Dataverse N:N relationships between records using the Power Pages Web API can be trickier as there are few samples around and the syntax differs a little bit from handling N:N relationships using the Dataverse Web API.
In this post I will show a quick code sample on how you can handle that, using a sample N:N custom relationship between Contacts and Accounts.
Prerequisites
- All required fields (including the N:N relationship name) in the code must be enabled for the WebAPI for the Power Pages site where you wish to run the code creation via Web API
- The WebAPI Wrapper code must be added to the page you are using the JavaScript code
- An N:N relationship between Contact and Account needs to be configured in Dataverse (out of the box a Contact can have only one Account associated, but with this custom relationship we can assign to more)
Associating a Contact with an Account in an N:N relationship
You can use the following function to Associate a Contact with an…
Source link
More About This Author
-
SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff).
Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.
Array
- Modern Workplace13 April 2024Power Pages and Cloud Flows – Validate user against Dataverse records based on Contact ID
- Modern Workplace6 April 2024Download SharePoint library files in Power Pages with JavaScript and Cloud flows – Improved code using jQuery & option to open PDF file in a new tab
- Modern Workplace13 March 2024Handle multiple N:N records associate and disassociate requests with JavaScript and Power Pages Web API
- Modern Workplace17 February 2024Generic JavaScript Functions to Associate and Disassociate Dataverse records using the Power Pages Web API