Answered by:
Custom Convert Lead Dialog Box

Question
-
I have created a custom convert lead dialog and everything works fine, but there is one more feature I would like to add. The ability to give the user an option to open the Account created from the Lead after the dialog closes. Just like in the Convert Lead Dialog that comes with CRM. Does anybody know if this can be done? I was thinking a Plugin, but my experience in writing plugins is limited.Wednesday, February 15, 2012 3:44 PM
Answers
-
Hi,
In order to do that, you need to refresh the Lead form (once the Dialog has been completed) and have some code onLoad to open the Account record (if your bit field is checked).
I believe if you open the dialog through a custom ribbon button, you should be able to put some JavaScript around what happens on completion of the dialog.
So … on the lines of what you have already started, my advice would be to try something like this:
- Add a checkbox/flag (on the Lead form) and ensure you can still reference the created Account from the Lead (ie. a relationship).
- Within your dialog … if a new Account is created, tick the new checkbox on the Lead and ensure that the Account is appropriately associated.
- Create a custom ribbon button with a JavaScript event that does the following:
- Opens your Dialog
- Once the dialog is closed, refreshes the Lead form
See the following thread for how to open the Dialog and refresh the source record on completion through JavaScript (scroll to the bottom) …
CRM 2011: Dialog Process - Refresh calling form when modal window is closed
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/263d213e-a835-4fdc-8de0-0c5324e55fae/
- In the OnLoad event of the form (which will be triggered after the refresh), have a function which checks the value of the new checkbox ... if it is ticked:
- Open the associated Account record
- Untick the checkbox and ForceSubmit
Good Luck!
Thanks,
MaryseThe xRM Architect:- Proposed as answer by - Maryse - Monday, February 27, 2012 12:33 AM
- Marked as answer by DavidJennawayMVP, Moderator Tuesday, March 20, 2012 9:23 AM
Friday, February 17, 2012 1:40 AM
All replies
-
A plugin in Microsoft Dynamics CRM doesnt allow interaction with the user interface very easily. I suspect you will need to write some JavaScript code to pop open the newly created Account record.
See this MSDN page. It will give you some ideas of URLs and parameters you will need to pass into your window.open call to achieve the functionality you're looking for: http://msdn.microsoft.com/en-us/library/gg328483.aspx
- Proposed as answer by Parvez Ghumra Wednesday, February 15, 2012 4:50 PM
- Unproposed as answer by Parvez Ghumra Wednesday, February 15, 2012 4:51 PM
Wednesday, February 15, 2012 4:37 PM -
This should work:
window.open(serverUrl + "/main.aspx?etn=account&id=" accountId + "&pagetype=entityrecord");
Blake Scarlavai - http://mscrmdev.blogspot.com/ - Sonoma Partners - http://www.sonomapartners.com/ - Follow @bscarlav
Wednesday, February 15, 2012 5:05 PM -
Thanks for your imput. I am familiar with how to open an entity with a URL though JavaScript, and thought about using this method. I’m not sure how to run the JavaScript at the end of the dialog to get the entity open.
Wednesday, February 15, 2012 7:22 PM -
You wrote the dialog. Set a flag. if (flag) window.open(....
confirm("the question to be confirmed");- Edited by mardukes Wednesday, February 15, 2012 8:01 PM
Wednesday, February 15, 2012 7:46 PM -
Good subjection, but didn’t work. I add a bit field on the account entity and JavaScript to open the entity when the bit field gets changed to yes. The JavaScript works on the entity itself, when changed to yes it opens another copy of the entity. I then added to my dialog to change that bit field to yes in the last step, but nothing happens. I think this is due to the data being written directly to the database. Any other subjuctions?
Thursday, February 16, 2012 3:43 PM -
Is that bit a radio button or list??
Regards Faisal
Thursday, February 16, 2012 5:10 PM -
Hi,
In order to do that, you need to refresh the Lead form (once the Dialog has been completed) and have some code onLoad to open the Account record (if your bit field is checked).
I believe if you open the dialog through a custom ribbon button, you should be able to put some JavaScript around what happens on completion of the dialog.
So … on the lines of what you have already started, my advice would be to try something like this:
- Add a checkbox/flag (on the Lead form) and ensure you can still reference the created Account from the Lead (ie. a relationship).
- Within your dialog … if a new Account is created, tick the new checkbox on the Lead and ensure that the Account is appropriately associated.
- Create a custom ribbon button with a JavaScript event that does the following:
- Opens your Dialog
- Once the dialog is closed, refreshes the Lead form
See the following thread for how to open the Dialog and refresh the source record on completion through JavaScript (scroll to the bottom) …
CRM 2011: Dialog Process - Refresh calling form when modal window is closed
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/263d213e-a835-4fdc-8de0-0c5324e55fae/
- In the OnLoad event of the form (which will be triggered after the refresh), have a function which checks the value of the new checkbox ... if it is ticked:
- Open the associated Account record
- Untick the checkbox and ForceSubmit
Good Luck!
Thanks,
MaryseThe xRM Architect:- Proposed as answer by - Maryse - Monday, February 27, 2012 12:33 AM
- Marked as answer by DavidJennawayMVP, Moderator Tuesday, March 20, 2012 9:23 AM
Friday, February 17, 2012 1:40 AM -
Sounds good Maryse, I'll give it a try next week and let you know the outcome.Friday, February 17, 2012 5:53 PM