09.08.2008, 01:17 | #1 |
Участник
|
Microsoft Dynamics CRM Team Blog: Client Extensions and Scripting Samples in the SDK Part 1
Источник: http://blogs.msdn.com/crm/archive/20...dk-part-1.aspx
============== I want to call attention to some of the client extension and scripting samples included in the SDK. There are a number of new capabilities and samples sprinkled throughout documentation. People who have been working with Microsoft CRM for a long time may not have noticed unless they make it a habit to compare each new release of the SDK with the previous versions or read the release notes very carefully. When creating samples for the SDK we have to be very careful not to include anything that is unsupported. Many of the samples are brief and very simple. But where possible we have tried to include samples that begin to approach some real business problem solutions within the constraints of strictly supported methods and constraints on length. These aren't intended to be full production quality solutions -but they should provide some ideas about how to apply and combine different techniques. If you have any samples that you would like to see, or feedback on the existing samples please let me know. Here is a list of a few selected newer samples, I'll discuss five more in my next post. • Add Customer Address data to the Case record form.Add Customer Address data to the Case record form. We were looking for a sample to illustrate how the CRM Web Service RetrieveMultiple message can be used in client-side JScript. I worked with Microsoft Dynamics CRM Developer support and they suggested that a common scenario is to add Customer address information to a case form. The result is the sample Retrieving Data from Related Records. This sample will not work with Microsoft Dynamics CRM Online as written because it requires an html page to be placed on the server. But I've been thinking that it could work in Microsoft Dynamics CRM Online if the HTML page could be generated in script defined for the button in ISV.config. If this is something you are interested in or have done - let me know. Integrate Live Search into your forms There are actually two samples that show how to do this. The first is Add Search Capability to a Form Using an IFRAME. This is a really easy method that illustrates how an IFrame can be used to host an external page and how code can interact with it to create a useful tool. However, it displays all the Live Search branding and advertisements. Despite how much we love Live Search here at Microsoft, I can see how that might be a little distracting. The second is a bit more sophisticated: Accessing Other Web Services. Ultimately the goal here was to show an example of how a web service external to Microsoft CRM could be used. In addition, the web service needed to be a web service that Microsoft provides. Finally - I wanted to create a sample that didn't require any files on the server so it would work with Microsoft Dynamics CRM Online. I wanted to make this something that would potentially useful, so I used the Live Search Web Service SDK to generate a more subtle search functionality and remove all the Live Search branding. Now the Live Search team has a cool interactive SDK on their web site to provide the server side code to call the web service - but our sample is all JScript. The end result looks like this: The search results are displayed in an IFrame based on the text in the Company Name field. The HTML for the search results is all injected into the contentWindow property of the IFrame using script. The major drawback for this sample as it is documented is that it only works for the onChange event when the Company Name field is changed. The code could also be configured to work when the form onload event occurs, but doing that required a few lines of code that uses an unsupported technique and could not be included in the SDK or in this blog (See Unsupported Scripting). We don't support definitions of event handlers or functions in event scripts because it may introduce complications during an upgrade. But I know this wouldn't stop many of you reading this. Let's just say that the IFrame contentWindow may not be ready to be written to when the onload event code fires. The IFrame loads asynchronously to the rest of the form. If there were a way to wait for the readyState property of the IFrame to indicate that it is finished loading ('complete'), the code would work just like it does in the OnChange event. Remember - any unsupported techniques might not upgrade gracefully. The way this works (or doesn't) could change in future versions. CrmService method samples I admit I struggled for a while trying to find good way to generate code samples showing how to call Microsoft Dynamics CRM web services in JScript. Unlike the strongly typed Server side code samples, we weren't going to have the resources to create full reference information and samples for calling each of the Web Service messages using JScript. At least we could mirror the basic method samples available for the server-side code. At the time, before Microsoft CRM 4.0 was released, it seemed that everyone was using Fiddler. The first sample I created was a basic walk through (Capturing Sample HTTP Requests) using Fiddler calling a WhoAmI message where I basically documented what I learned along the way. Later, I used Microsoft CRM MVP Michael Hohne's solution to capture generate these script samples based on the strongly typed .NET code. I highly recommend Michael's solution. Summary I hope that you found something you didn't know was in the SDK. In my next post I'll cover : • Add default form data values using QueryString argumentsIf you have any questions or comments about the samples - or ideas about new samples you would like to see. I'd love to hear from you. Jim Daly Источник: http://blogs.msdn.com/crm/archive/20...dk-part-1.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Похожие темы | ||||
Тема | Ответов | |||
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM 4.0 Bookshelf | 1 | |||
Microsoft Dynamics CRM Team Blog: Client Extensions and Scripting Samples in the SDK Part 2 | 0 |
Опции темы | Поиск в этой теме |
Опции просмотра | |
|