Dynamics 365 Portals: Create new entity record from within Lookups

If you have used Dynamics 365 you must be familiar with the + New button on the lookup. This enables the user to create a new item instead of selecting an existing one.

This feature has been a frequent ask for Dynamics 365 Portals. The good news is that this functionality was added by the product team a few releases back. The bad news is that it is only partially done.

In this post, I’ll walk through the steps for configuring it and its limitation.

For this example we will update the Dynamics 365 Portals profile page and change the organization field from a Textbox to a Lookup to accounts, This will enable users to select an existing account or create a New account in case it doesn’t pre-exist.

In a un-managed solution, add Information form for “Entity form Metadata” entity, add “Profile Web Form” for contact entity and add account entity.

Modify the Information form for “Entity form Metadata” to include “Entity Form for Create” field on the form.

Next, Update the “Profile Web Form” to add our lookup field for the account instead of “Organization Name” text Field and this will be our new lookup field on Portal.

Create a new account form which will have the fields we want users to add while creating a new account.Publish your customizations.

Once you have the forms updated, navigate to Portals configuration area and create a new entity form for account entity using the new account form. Account entity form doesn’t need to reference any webpage.

Next, Create a new entity form for profile page using Contact entity.

create a new Entity Form Metadata for profile entity form, select lookup field as attribute and set “Entity Form for Create” to the account entity form created in the previous step.

Now we need the Portals entity permissions to enable users to create accounts, for our purpose I am creating permission in global scope but you may change it to suit your requirements. Associate the entity permission with authenticated Users webrole.

At last Update the OOB Profile page to use “Full Page” as a Page template and use the new Profile entity form. ensure changes are done on root page as well as the content page.

Now login to Portal and try to update the Profile page, you will be presented with a Lookup for company name field and upon click of the search box, you will be presented with a Modal window with an option to select existing account or create a new one.

This feature is a great way to allow users to work with one form while creating other entities in the process if required rather than using a multi-step webform. This feature currently doesn’t work on webform as the “Entity Form for Create” on the Webform Metadata is referencing a Webform instead of Entity form, Hopefully, product team will rectify this in the future release.

Note: This feature is available for Dynamics 365 Portals(8.3.3.133) and xRM Portals Community Edition

Note: This post was originally posted on Kunal Tripathy's blog.  Kunal is the Technical Team Lead for Services Delivery with Adoxio Business Solutions.