In my previous post Creating and removing N:N relationship between Dataverse records using Javascript and Power Pages Web API I showed how we can leverage the Power Pages Web API to handle single N:N associate and disassociate requests for a custom N:N relationship between Accounts and Contacts.
In case we want to extend that to be more generic to any N:N relationship we can leverage a custom function that can be used in multiple pages easily.
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 two tables you want to handle programmatically needs to be configured in Dataverse
Refactored Generic Versions of the functions
Following the principles explained in the previous post we can create more generic JavaScript…
Source link