I don't even know if this is possible. I have a "new form submission" screen created. There are six required fields to submit a new entry. One of those required fields is 'Account Name'. I would like to take the 'Account Name' field off the form and use a combo box to choose one or more accounts to submit the same form to. Basically, I want to use the form to create the same CRM entry item for multiple accounts at once.
Super interested to hear if anyone has thoughts on if this is possible how I might accomplish this task.
Hi @RandyHayes , thank you for your response! I am working through the scenario and getting close, but not quite there yet. I'll respond here when I get this operational over the weekend. Really appreciate the help!!
Just reading through your post and I don't believe what you are looking for will be handled with that formula but in a different scenario (even though the ForAll is backward).
If you have multiple accounts in the Combobox, then the trick would be this...your Form will do the SubmitForm as usual for one of the accounts selected. Then in your OnSuccess action of the form you would then create the others.
This is based on the assumption that the Account Name is a text field and your Combobox has a table of records with an 'Account Name' column. Adjust as needed.
For your Form, you will still have (and need) the Account Name datacard. This can be hidden if you don't want people to interact with it.
The Update property of that Datacard would be: First(yourCombobox.SelectedItems).'Account Name'
Then in your OnSuccess action, the following Formula:
Patch(yourList,
ForAll(Filter(yourCombobox.SelectedItems, !('Account Name' = Self.LastSubmit.'Account Name')) As _item,
Patch(Self.LastSubmit,
{ID: Blank(),
'Account Name': _item.'Account Name'
}
)
)
)
Replace ID in the above with the name of your Primary Key column name.
This will first, from the SubmitForm, Submit a record with all of the entered data for the first selected account name.
Then the OnSuccess will create a Table with a ForAll (its purpose). It will use as its data source, the table of records from the SelectedItems that do NOT match what was last submitted (this will be the remaining items selected and skip the one just submitted). Then the LastSubmitted record (all of the record data submitted) is patched with a blank ID (this will cause Patch to create a record instead of modifying a record) and the 'Account Name' column is filled in with the choices from the combobox.
This entire table is then given to Patch for your list, that will then do the appropriate actions based on the ID.
I hope this is helpful for you.
Hi @WarrenBelz ! Thanks for providing some direction. In this case, the form datasource is Dynamics CRM and all required fields are showing in the NewEntryform page set as default new. After completing all fields I can hit the icon to Submit(newentryform) and it will execute to create the new item in Dynamics CRM. If I pull the Account.DataCard out of the form it will create an error when submitting "required fieldmissing". I think what you are suggesting is I alter the code so when I hit submit it will patch form and repeat the action for each of the multiple combo box selections. For instance, if three accounts are selected in the combobox I need three seperate form submissions to be sent into Dynamics individually.
I'm not sure I yet understand how to patch the account name combobox into the form so the two transmit as one form to CRM. But I will give your suggestion a try this afternoon! Thanks again for your guidance!
Hi @josjohns ,
You would use a multi-select combo box and then a ForAll() statement to Patch the records (only rough syntax below)
ForAll(
ComboBoxName.SelectedItems AS aPatch,
Patch(
SPListName,
Defaults(SPListName),
{
AccountName:aPatch.AccountName,
OtherFieldsHere
}
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,075
Most Valuable Professional