Using command button to open a quick create form in D365.

 Hello Guys,

In our previous blog we have seen how to implement pagination for Data Table in canvas app. Today we will see how to use command button for opening a quick create form.



Do follow us to know more about Dynamics and Power Platform. Also if you like our blog then please comment and share this blog with your friends.

Consider a scenario where we need to display a quick create form for child entity. In this case Power Platform allows us to use Command button and customization.



As you can see in above image, we have a solution which contains contact table and one quick create form.

Now we will display this quick create form on Account Table. 

First of all we will be adding Account Table in a solution and then customize it.



As you can see we have added Account Table in solution.

Now to customize Command Button we need to open the App (Model Driven App. eg. Sales Hub or any other which you have already created.).



As you can see we have our App designer. Now select the Account and select three dots near by Accounts View as shown below:



Click on Edit Command Bar. This will open a new window as shown below:



Select Main Form and click on Edit. This will open a window as shown below:



Now we will be adding a new command button. Click on New below the Search and select Command. This will show a popup window with two option i.e. Power FX and JavaScript. 



Currently we will select JavaScript. Later on we will explore Power FX too. Select JavaScript. This will display property window. Configure it as shown below:



Now as we have selected JavaScript, we need to specify JS. Click on Add Library. If you already have web resource you can choose it from the list else you can create a new web resource. We will be creating a new web resource as shown below:



Above web resource file contains below js code:

function createBloggerContact()

{

var tblContact={};

tblContact["entityName"]="contact";

tblContact["useQuickCreateForm"]=true;

tblContact["formId"]="4cc2c98a-5c93-ee11-be36-6045bdf0065c";//ID of the form

Xrm.Navigation.openForm(tblContact).then(function(success){

console.log(success);

}, function(error){

console.log(error);

});

}

Learn more about Entity Form Option

Now specify the function name and save the changes and publish the App. Once published, open any Account Record.



As you can see, we have our newly created command button. Click on it. It will display a quick create form as shown below:



Hope it helps....

Comments

Popular posts from this blog

Read Only Sub Grid & Editable Sub grid in Dynamics 365

Understanding Sales Process in D365.

Understanding Business Unit in Dynamics 365.