Home
> Uncategorized > CRM 2011 Dialogs–A couple of gotchas
CRM 2011 Dialogs–A couple of gotchas
A couple of things to look out for as you start writing Dialogs:
- If your Dialog has branching logic make sure you don’t use the Responses from those branches in any later actions after the branching as those Response values will not be available in those scenarios when the user branches the other way, and CRM doesn’t like that. To get around this make use of Variables within your Dialog. Initialise a Variable at the start of your Dialog, update it within your branch and then you can happily refer to the Variable later in the script.
- Beware of placing actions such as creating records and sending emails in amongst Pages of your Dialog, they’re better placed at the end of your script firing only after the user has clicked Finish in the Dialog. Reason for this is the Dialog UI happily allows users to navigate backwards and forwards within the Dialog. If you have a record creating firing between pages 4 and 5 of your script that record creation will happen not only the first time the user progresses to page 5 but if they hit previous, go back to page 4 and then progress on to page 5 again then yeap you guessed it you will get another record created.
HTH ![]()
Gareth
Good Work. Useful tips.
2 more for your list…
1. Cannot use global option sets. I have a dialog where I am prompting for the customer’s state field. That’s 50 options I need to recreate. What a drag… As an alternative, I was hoping to be able to create a query against the Option Set entity but it isn’t made available.
2. If I prompt the user for the state and they neglect to fill it out (or similarly if you need to prompt the user for a value that may not be applicable for the record you are creating) the dialog places the first option set value in the created form’s state field. Weird…
How do you add actions at the end of the dialog so records are only created after user clicks finished? I tried creating two stages (the 2nd stage being at the end of the process with no pages, that creates the records), and both stages still get processed before the user clicks finish. If I add a Stop Dialog step before the 2nd stage, it doesn’t get triggered at all. So I’m confused on how one would achieve your 2nd gotcha in the above post. Any advice would be greatly appreciated.
Hi, not sure there is a decent solution to this. My advice is to put your actions at the end of your dialog definition wheneever possible to minimise the issue. But, you can’t have dialog actions run after the Finish button. If you are launching the Dialog from a custom Ribbon button via jscript you can fire code on the Dialog window’s close, but then you would need to write your actions in jscript, not in the dialog. Something I saw in a demo recently was a Dialog where the last page before the Finish button page dispkayed back to the user hyperlinks of CRM records that were created by the Dialog. This is kind of cool, providing instant navigation options to the user. But it also makes it clear to the user that the records have been created by that point, and they would hopefully think twice before clicking the Back button. HTH.
Hi Gareth,
do you know if there is a way to create a quote (and adding products quote) through a dialog process
Creating a Quote record is simple enough from a Dialog, just like creating any record type. Quote Product creation however is not supported by the Dialog designer. You need to get a little bit creative, here’s some approaches: 1) Use a custom entity, create records in that entity from the Dialog and then use a Plug-in to create the Quote Product records based on the custom entity records. 2) Capture quote product details in the Dialog and populate into fields on the Quote record and then use a plugin to create the Quote Products records. 3) If you call the Dialog form from jscript you could ahve additional jscript fire on close of the Dialog form that creates the Quote Product records (tricky though, as you likely need data captured during the Dialog session). HTH
One way that I found works for number 2 is to put the action (and any feedback to the user re success/faliure) in a child dialog. Then link to the child dialog, as you said, at the end of the main dialog. When you link to a child dialog I found you can’t go back to the main dialog – so problem solved?