Method Xrm.Utility.openDialog is deprecated, but why? - dynamics-crm

Method Xrm.Utility.openDialog() is deprecated, but I can't find any information about this method, and any alternative for this?
Can you help me to find alternative method for openDialog()?

As far as I know there has never been a function called Xrm.Utility.openDialog().
A few years ago developers used window.showModalDialog() to open custom modal windows from within Dynamics CRM. However, popular browsers like Chrome stopped supporting this function, which had been an IE invention anyway. Modal dialogs block access to the main opening window and harm user experience on tablets and smart phone interfaces, so nowadays they are considered to be a bad design choice.
As an alternative some Dynamics CRM developers started using the internal function Xrm.Internal.openDialog(). Nevertheless this function has never been part of the supported API and should not be used.
An alternative would be to inject een IFrame at the end of the body of the page and display your dialog in it. This is the way built-in Dynamics CRM dialogs currently are implemented.

Microsoft told me what I must use Xrm.Utility.openWebResource() method.
Thank you

we have a custom ribbon button that runs a dialog on demand using JavaScript. This is a snippet of the code that you may find useful. We do not use .openDialog().
window.open(
Xrm.Page.context.getClientUrl() + "/cs/dialog/rundialog.aspx?DialogId="
+ encodeURIComponent(DIALOG_ID)
+ "&EntityName=new_entityname&ObjectId=" + encodeURIComponent(ENTITY_ID),
"formRibbon_runDialog_" + DIALOG_ID + "_" + ENTITY_ID,
"height=480, width=615"
);
It is also worth noting that Dialogs in general are deprecated by Microsoft, but it will likely be many years until they are truly removed from the system so it's not much to worry about.
Let me know if you have any questions.

Related

PowerPoint - how to run a macro automatically?

I'd like to run a macro that sets the zoom to 100%, something like Windows(1).View.Zoom = 100, every time ANY file is opened in PowerPoint. The files are already created, so using a template to set the zoom is not possible. How can I do this?
There isn't really a way (that I am aware of) to do this through a macro or powerpoint add-in. You might be able to do it using a custom web add-in but I don't have enough experience with that to provide an example.
After looking around there have been a few success stories. One of which is creating a custom UI element and then adding an onLoad hook to that.
Here is the thread.
Here is a link to the Custom UI Editor Tool However I had no luck in getting it to work. I believe (This is only my theory) that it is not compatible with the latest .NET framework.
If you do end up trying to do this, here is a link to the xml formatting documentation for UI elements. And a link to a little tutorial related to this.
Sorry I couldn't be of more help. This should at least get you started. If anyone else has a simpler way I would love to know as well.

Where does one enter the JavaScript code in CRM Dynamics? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I update form field on Microsoft CRM Online via Javascript
I've started to play with CRM Dynamics yesterday so this question should be seen as a very basic one. I've been coding for many years but CRM D is news to me.
Apparently, one is supposed to be able to enter JavaScript code to customize the behavior of the application. I've understood that there's an API for that and that touching DOM directly or playing with jQuery is a no-no.
Question: Where is the JS-code supposed to be entered? I've gone through all the menus but as far I can see, there's no spot where I could plug-in my custom code.
E.g.: Where do I get to define a validation for the last name of a contact currently being defined?
So I would suggest checking out these articles.
This ones gives a general overview of JavaScript in Crm - MSDN.
You are probably going to most commonly use JavaScript on the form - MSDN.
Also check out this tutorial which explains how to use form events and libraries. This tutorial in the same series gives a basic example.
You are allowed to use jQuery in some circumstances as described here - MSDN.
To enter the JavaScript first upload it as a web resource. Then if you want it to fire for example on load of the form, go to the form customization, Form Properties:
From there a menu should pop up:
In the Form Libraries add the Java web resource. In the Event Handlers select the Javascript you are using and the function name. Hope this helps :) Gdluck

Disabling the zoom/pan/scroll functions for the Webbrowser Control

I have seen many posts about how it's impossible to disable the zoom/pan/scroll functions on the Web-browser control natively for Windows Phone 7. So what options do we have?
I did a little digging and I found a quick way to do so, so I thought I'd share it here.
It's not a quick few lines of code which is a shame but all of it is up on the web so it should be easy to implement. First you need the Linq ddl and this class here called LinqToVisualTree. Then you can use these in a WebBrowserHelper class where you just pass in your web browser when you create the webBrowserHelper and the rest is taken care of. You can even set whether or not you'd like the scrolling to be disabled.
One problem I found with this was that when I double tap on the web page it still zooms in sometimes. Does anyone know how this might be fixed? I'm sure there is a way to do it using the LinqToVisualTree but I can't figure it out.

Customizing Associated Records displayed in the Form Assistant (MS CRM 4.0)

I've recently customized the lookup functionality of MS CRM 4.0 to filter a contact list to only those contacts owned by a client using techniques similar to the one presented here:
http://advantageworks.blogspot.com/2008/02/pseudo-filtered-lookup-dialog-in.html
My question is, can I apply the same type of logic to the Form Assistant pane within the window? I've currently disabled the form assistant to prevent confusion, but I'd very much like to filter those contacts as well. I like the inline AJAX presentation of that data more than the lookup pop-up window, but I can't find any information on how that thing is working.
Anyone out there done this before?
Thanks in advance!
Bob
As far as I can tell from the research I've done - customization of the Form Assistant pane in MS CRM 4.0 in this manner simply is not possible. In those cases where we required this customization we opted to hide the Form Assistant to prevent end-user confusion.
Boo MS.
Boo.

How can I filter by file type in an IExplorerBrowser in Windows 7 Libraries?

I've created an instance of IExplorerBrowser in my code to create a custom I/O view in one of my dialogs. I've implemented the IServiceProvider and ICommDlgBrowser interfaces in my host class. I use the IExplorerBrowser::BrowseToIDList method to fill the view.
I would like to filter the file types displayed (ex. only PNG files). If I call BrowseToIDList with FOLDERID_Pictures (i.e. "My Pictures") I can use the ICommDlgBrowser::IncludeObject method or IFolderFilter::ShouldShow to restrict which files I allow to be displayed. However, if I browse to the Picture Library on Windows 7 (FOLDERID_PicturesLibrary), neither ICommDlgBrowser::IncludeObject nor IFolderFilter::ShouldShow are ever called.
Is there some limitation to filtering files in libraries on Win7 that I'm unaware of? Perhaps I'm missing an interface or maybe I've specified the wrong flag somewhere.
Any ideas would be greatly appreciated.
I've had a chance to research this further, including asking a few questions to some Microsoft developers. It would appear, unfortunately, that filtering does not work with query backed views (i.e. Libraries).
An alternative to my approach would be to use the Common Item Dialog with application added controls (via IFileDialogCustomize).
(http://msdn.microsoft.com/en-us/library/bb776913(VS.85).aspx)
In my specific case, I'm unable to use a Common Item Dialog, but I thought it might be worthwhile to post this information here for future reference.
If in the future I find any way to filter an IExplorerBrowser control, I'll post that back here too.
I encountered this issue myself.
Yet I have investigated it a little bit further. IExplorerBrowser creates (on my Windows 7 x64 machine) window of ExplorerBrowserControl class. Which itself creates a window of DUIViewWndClassName class. And the very same window (DUIViewWndClassName) is used as a control by dialog created by IFileOpenDialog. Even window procedures are same so there is no subclassing (but I haven't checked each and every subwindow of that control).
And file dialogs are able to filter by file type even in the library folders. So I guess the IExplorerBrowser (or the control it uses) does allow that only Microsoft does not share knowledge how to do that. Or if it does then its somewhat hidden knowledge.
But I got it with IFolderFilterSite (interface supported by IExplorerBrowser from CLSID_ExplorerBrowser). IFolderFilter::ShouldShow isn't called in such cases for library folders. I wasn't able to get ICommDlgBrowser::IncludeObject called (even if I didn't set any IFolderFilter).
EDIT: I managed to get ICommDlgBrowser::IncludeObject called. Somehow I forgot that I have to provide ICommDlgBrowser through IServiceProvider::QueryService rather than through IUnknown::QueryInterface. But still ICommDlgBrowser::IncludeObject is not called for library folders.
I tried using IShellFolderViewDual3->FilterView().
But it's search results.
Thank you.
IShellView *pShellView;
IDispatch *pDSFV;
IShellFolderViewDual3 *pSFVD3;
m_pExplorerBrowser->GetCurrentView(IID_PPV_ARGS(&pShellView));
pShellView->GetItemObject(SVGIO_BACKGROUND, IID_PPV_ARGS(&pDSFV));
pDSFV->QueryInterface(IID_PPV_ARGS(&pSFVD3));
pSFVD3->FilterView(bstrVal);

Resources