In this post I will explain how to launch a Dialog from Ribbon Button in Dynamics CRM. The requirement is like configure a custom ribbon button on custom entity which will launch a dialog (Process).
In this Example, I’ve used custom entity “Flight Route” contains a button called “Test Button” which will launch a dialog. Dialog will select a flight name from the option set and insert new note record on the selected flight route record.
Following are steps that demonstrate launch dialog from ribbon button.
Before to start with a launch dialog, we need to create
1. Create a dialog for “Flight Route” entity
· Select Solution.
· Select Processes.
· Create new process.
· Specify the Process name.
· Select Entity.
· Select “Activate as” as “Process” and “Category” as “Dialog”.
· Configure it as an on-demand process.
· For this dialog make sure that it should contain at least one
“Prompt and Response”
· Click on Text Editor.
Insert below function in Text editor window.
dialogId is id of the dialog we need to open from button (String Parameter)
typeName is entity’s logical name (String Parameter)
recordId is entity’s current record id form where the dialog will be launched.
3. Get the Dialog Id Value
· Once you have created new dialog.
· Click Start Dialog.
· That will open new dialog window.
· Get the dialog id value from the URL(Ctrl+N) and note it down somewhere,
to use the same in coming steps.
4. Insert custom button on entity’s form using Visual Ribbon editor. ( To create a new button on ribbon, you can refer below link---)
5. After inserting a new custom button,
· Click on Add link for specifying the “Function name” and “Library”
a. Specify function name and library name.
b. Click on “Add” link as shown below. It will open a list of
parameter types which you can pass with the function.
· Clicks on save. It will save and publish the changes on CRM server.
6. Now you can verify the button on your entity’s form ribbon.
7. On click of this button your dialog will be launched.
8. Select Flight Name from the list and click next and then Finish on the last screen.
9. At the end, a note will be generated on Flight Route entity