If you want to create a record with its child records in Power Pages, there is no way to do it using out of the box forms. But you can do it using JavaScript Power Pages Web API, and with a single Web API call.
In this blog post we will use the example of creating an Account with 2 child Contacts in Power Pages.
Prerequisites
- Enable both the Account and Contact tables for the WebAPI
- Enable the fields used in the WebAPI call for both tables (including the relationship field)
- Configure proper table permissions for both tables (so users can create items and associate contacts with accounts)
- Include the ‘WebAPI’ wrapper (sample from Microsoft) in a web template so you can use the webApi.safeAjax function as below
How to setup the request
In your JavaScript code, define a variable or constant with the object you want to submit.
This needs to contain all the fields from the parent object (account) and the array of child objects (contacts) under a property with the…
Source link
More About This Author
![michelcarlo](https://i0.wp.com/365community.online/wp-content/uploads/2020/04/C6zQCIg6_400x400.jpg?resize=150%2C150&ssl=1)
-
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 Workplace24 July 2024Power Pages Table Permissions: Configure permissions to see records from child Accounts
Modern Workplace15 July 2024Copy Dataverse contact phone numbers across different environments based on Contact e-mail address using Power Automate
Modern Workplace1 June 2024Get the current logged Power Pages user Contact ID via JavaScript and use it to create records assigned to the current user
Modern Workplace11 May 2024How to get the current Azure Devops iteration name for a project using Power Automate