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

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

Related

Method Xrm.Utility.openDialog is deprecated, but why?

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.

Custom form in Outlook Task is not syncing

My partner and I created a custom task form to be used in Outlook using the developer mode to do that, and we published it to the Organization Forms Library for anyone to open. We're running into issues that I personally can't seem to find on how to resolve:
Custom forms aren't syncing correctly.
When I complete out the custom form, and I assign it to someone else they might be missing details like the dates I picked from the date picker, and text within the text box are gone too. It's very odd that sometimes some would get all the details that an end-user would input but that's like a 1/8 chance. I feel like there's a disconnect where it just won't behave like any other task. Cache mode or no cache mode doesn't matter it seems. When the person assigns it back with changes made on their end, those changes aren't seen on my side. I just have the same original details that I made when I first made it. We're on Exchange Server 2010.
Looks like a custom form was not published correctly to others in the organization. Try to create a new Outlook item on other machines with your custom forms to make sure they were deployed correctly.
Note, message forms default to separate layouts for composing and reading. Many people find their first message form doesn't look right when they receive an item created with it. That's simply because they forgot to click the Edit Read Page button and customize the Read layout!
You may find the Customizing Outlook Message Forms article helpful.

Dynamics CRM option set

I am new to Dynamics CRM so please excuse me for the newbie question xD
I managed to create an option set field with 2 possibilities:
Scheme 1
Scheme 2
Does anyone have an idea how when a particular possibility is picked, a list of custom based fields will appear in the form? Thanks in advance
If i understand your problem correctly you want certain fields to appear/disappear according to the choice selected in the option set.
The way I see this working is by implementing a Javascript on the onChange event of the option set. you can do this from the 'Form Properties' when changing the layout of the form.
Below is a link showing some examples of possible useful commands that might help you:
http://www.powerobjects.com/blog/2011/01/14/crm-2011-useful-javascript-tidbits/
You can put your custom fields in a custom tab and then hide/disable it according to the value in the option set.
If you have any further problems feel free to ask :)
I hope this helps :)
Gdluck
If you are comfortable working in Visual Studio, I highly recommend installing the Developer Toolkit (You can find the .msi \tools\developertoolkit - download it from here). It will allow you to develop JScript with some syntax highlighting and intellisense and makes source control and deployment a snap.

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.

Telerik RadGrid working examples

I'm looking for some examples of production websites that currently use the Telerik Rad Grid. I'd really like to see some real world scenarios in action, other than the Telerik RadGrid demo. Does anyone know of any websites that use it?
This article from their website says that MSDN, TechNet, and CodePlex websites are using pieces of their components.
"Microsoft has chosen to implement RadEditor in the Wiki Annotation Editor...[and] all Project Discussion pages, becoming the custom inline editor."
Here is one for you... The first tab uses the RadGrid control and the second tab uses the RadScheduler control...
[link redacted per request of site owner]
I will post blog on this later to demonstrate
There are some case studies on their website. like for winforms, asp.net ajax etc.
Most controls like that are used in internal webapps. It is hard to provide public facing examples of sites using DataGrid-like at all(not impossible, just rare), let alone by one vendor on one platform.

Resources