kivikall
kivikall

Reputation: 795

How to create a custom html dialog in CRM 2011

I need to customize (read. replace) CRM 2011 default "Close opportunity" dialog with a custom dialog because I've read that we can't customize the default dialog (in a suported way)(?). In that way I can then add my custom logic on it, right?

Doesn't that mean that I have to create an html page and then open it from the ribbon button for example? I do not need to add any fields on it. I only have to check if some fields have certain values and if they have then after closing an opportunity I need to open a new form.

Are there any examples how to create a custom dialog window so that it would look like the default one? What styles do I need etc.? I found UX Design guide from the SDK but to be honest I have no idea how to interpret it. I also got my hands on one custom dialog my colleague has made but it seems way too overkill for my purpose. It includes countless image, script and style files and hundred of lines of code. Just makes me wonder that there has to be an easier way?

Any advises are welcome :)

Upvotes: 1

Views: 2832

Answers (2)

kivikall
kivikall

Reputation: 795

After some researching I figured out the most perfect way to accomplish this task.

I took a look at what happens in default Close opportunity ribbon buttons and I noticed they both call "complete(bWon)" function from "/_static/sfa/opps/opps.js" file. There's also a performActionAfterCloseOpp(ret_val) function which was exactly what I needed because I didn't need to modify the dialog itself but instead just add some logic there after the user has closed an opportunity.

So I did hide both default buttons and created my own ones that will call complete(bWon) function (from my own web resource) which in turn will call the performActionAfterCloseOpp(ret_val) function where I did add my custom javascript.

I could have done this with plugin but as I said in my first post I needed to be able to open a new form in certain cases which I'm able to do now.

Upvotes: 0

MarioZG
MarioZG

Reputation: 2087

To create custom page that looks like system dialog, easiest way would be to save CRM dialog as html and edit it to reflect your needs.

Please note that in IE you cannot do save as from dialog, so you need to either note url from status bar and type it into url in new tab, or use Firefox where you can copy url from address bar (its available in dialogs)

Upvotes: 1

Related Questions