We sometimes need to add multiple records to a related form grid. Let’s work with two entities as an example: Quotes and a custom child entity called Assets. We could manually create Asset records from the Quote. Once we have mapped the fields down from the Quote to the Asset entity, all we need to do is create a new Asset record from the Quote, enter the Asset Number, and the system will do the rest. However, to add 50 Assets is a lot of work, right?

Using Dialogs

With Dialogs, we can automate the creation of all Asset records. In this example, we’ll have a look at creating multiple assets for a quote in Dynamics CRM using Dialogs. To do this, let’s create two Dialogs:

  • Asset Scheduler – This initializes the loop and creates the first Asset record.
  • Asset Creator – This is a child Dialog that calls itself and creates all the other Asset records.

The Asset Scheduler looks like this:

asset scheduler


Both Dialogs run from the Quote entity. In this one, we confirm the values held on the Quote (Asset Category, Asset Type, and Quantity) and write them back to the Quote with the Update step. We then create the first Asset.

Finally, we call our looping Dialog to create the rest of the Asset records, passing it the Asset Quantity. The looping Dialog looks like this:

looping dialog


Firstly, it takes in the previous quantity value, and if the last Asset was the final Asset, i.e. Quantity = 1, the Dialog ends. If this is not the case, a new Asset record is created. We then update this record to reduce the Quantity by one. The quantity can be taken as an input parameter.

In the next step, we want to loop the Dialog, but we do not want a Dialog page to appear many times. Every Dialog requires a Page with an associated Prompt and Response.  To meet this criterion, we embed it in an If-Statement which will never succeed.

The Final Result

The end result is a set of Assets against the Quote.

To create the Asset records, the user simply fires up the Dialog from the Quote.

asset scheduler 2


Enter the values for the three fields, then click Next and the Dialog shows “Finish”.

dialog shows finish


After clicking Finish, the Quote would have a full set of Assets against it.

To conclude, we can create powerful inbuilt tools for the user by combining functions with Dialogs. Creating such tools in the past required plugins to be developed. Now, a CRM administrator can take over the control and configure as required.