web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

A form to create multiple new table rows

(1) ShareShare
ReportReport
Posted on by 439
Model-driven app using Dataverse.
 
I wanted to make a screen with input fields at the top of the form and a grid of records on the bottom half of the form. 
 
legacy Command bar button, form level, to create multiple records based on the input fields. 
legacy Command bar buttons grid level to delete multiple or update multiple.
 
input field 1 is a Customer lookup, input field 2 is a multiple select field.  
on change the Customer lookup fills the grid with the rows for that customer from a custom table.  
 
The multiple select field allows the selection of multiple record type indicators, like if this was Color table, the multi select would have red, blue, green, yellow, orange, etc.
 
so, the user can select a Customer and the several indicators. 
 
now to create multiple records based on these inputs the Create Multiple form level command button calls a javascript that processes the input into Web API calls to createRecord.  the records are created, the grid is updated.  all is well.
 
The biggest problem with this is that the "form" is being subverted for a different purpose than intended.   so, when the input fields are dirty, the Save unsaved changes dialog is fired.
 
I cannot find any way to prevent this.  I have not found a way to fire anything before that dialog pops up.
I do have a close button by which the user can exit the form without the dialog because I can reset the input fields to make the form not dirty.
 
but I have not found a way to make the input fields not dirty when the user navigates away or clicks the back button.
 
I do not clear the input fields after the Create multiple form level button is clicked... mostly because I dont want the user to have to re-select the indicators again.  Typically, they are going to create the same records for multiple Customers.
 
I know this is really hack, but it does save my users a lot of clicks and time. 
 
thoughts, concerns?
 
I sure would like to see Powerapps make it possible to do this OOB.  Anyone else think this could be useful?
 
I have the same question (0)
  • Suggested answer
    Ray Profile Picture
    1,537 on at
    A form to create multiple new table rows
    I think you can call the save function to save the data before call the createRecord.
    formContext.data.save(saveOptions).then(successCallback, errorCallback);
     
    Also, you can use below code to ignore the dirty field, but this would made the field change been ignored.
    formContext.getAttribute(arg).setSubmitMode('never')
     
     
    As you said "Typically, they are going to create the same records for multiple Customers."
    Actually I would consider change the customer lookup into a subgrid to let user select multiple record in one time.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 179

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 129 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans