420 likes | 549 Views
XRM in practice and advanced topics. Martin Straumann Technologie Team Leader Noser Engineering AG. Noser Engineering AG.
E N D
XRM in practiceandadvancedtopics Martin Straumann Technologie Team Leader Noser Engineering AG
Noser Engineering AG Noser engineering ag is a leading and long established provider of technical software and services.Our team, of more than 100 engineers across several locations within Switzerland, implements demanding software solutions and carries out software test and test-automation projects. ============================= noserengineeringag talackerstrasse 99 CH-8404 winterthur martinstraumann technologieteamleader Tel.: +41 (0)52 234 56 11 - zentrale Tel.: +41 (0)52 234 56 17 - direkt Mobil: +41 (0)78 707 32 23 Mail: martin.straumann@noser.com Infos: http://www.noser.com =============================
Agenda • XRM Business-Example ServiceTime • Extracted democase example • Entity customization • External crm data handling • Custom object integration with silverlight & microsoft virtual earth • Q&A
XRM Business-Example ServiceTime is an integrated fleet- and service management solution for order entry, service disposition and tracking in an ERP system. GSM / UMTS • Order disposition • Current order status • Automatic routing optimization • Vehicle overview on a map • Connected to any CRM / ERP system • Navigation to the order • All information over the order • Direct print to customer • Communication Dispo / Driver
Mobile Client Mobile Business Integration Server Backend Solution Mobile Sales Mobile Service … Document Service Backend Connector Microsoft Dynamics CRM/NAV/AX orother Backend LOB Applications Deployment Service ServiceTime Logging Service Tracking Service CRM 4.0 SQL Server CE Merge Replication SQL Server Merge Replication SSIS CRM 3.0 Reference Database Staging Database Resource Database Microsoft SQL Server component Server Connector and Integration Objects Backend Business Solution ServiceTime in combinationwith Microsoft Dynamics Mobile Development Tools
Forklift businesscase demo Martin Straumann Technologie Team Leader Noser Engineering AG
Mobile Client Mobile Business Integration Server Backend Solution Mobile Sales Mobile Service … Document Service Backend Connector Microsoft Dynamics CRM 4.0 Deployment Service ServiceTime Logging Service Tracking Service SQL Server CE Merge Replication SQL Server Merge Replication SSIS Reference Database Staging Database Resource Database
Extracted case example • Showing the location of CRM resources on a virtual earth map • Using defined vehicle resources from CRM • Map integration in CRM with Silverlight • Integration of GPS position from an external WCF service
Architectureoverview Windows Server 2008 CRM IIS WCF GPS-Service SilverlightVirtual Earth SilverlightMapapplication CRMWebservice SQL Tracking Data CRM Virtual Earth
What do weneed? • CRM • Custom vehicle entity • Testuser account • Custom site for the Silverlight application • Silverlight • Virtual Earth component and vehicle component • CRM webservice • WCF-Service of the GPS tracking • GPS Tracking WCF-Service • SQL database with the GPS data • WCF-Service with it logic
Vehicle entity & useraccount demo Martin Straumann Technologie Team Leader Noser Engineering AG
TIP 1: UsingtheMetadata Browser • http://yourservername[:port]/yourorganizationname/sdk/list.aspx
TIP 2: Utilities • The Customization Comparison Utility lets you compare the customization files between two Microsoft Dynamics CRM systems • The Configuration Data Utility lets you transfer custom configuration data from one Microsoft Dynamics CRM system to another.
TIP 3: Sitemaperror • There is a slight chance that an error in the Site Map could cause the Navigation Pane to not render correctly and it could become impossible to navigate to the Import Customizations area to fix the problem. In this event, you can access the Import Customizations area directly. • http://<CRM_Servername>/<Organization_name>/tools/systemcustomization/ImportCustomizations/importCustomizations.aspx
Application architecture Silverlight IIS CRM Page, XAML IVehicleData VehicleData BusinessLogic BusinessLogic Dataset GPS Data
Obtainorganizationinformation • // STEP 1: Instantiate and configure the • // CrmDiscoveryService Web service. • discoveryService = newrmDiscoveryService(); discoveryService.UseDefaultCredentials = true; • discoveryService.Url = "http://localhost/MSCRMServices/2007/AD/CrmDiscoveryService.asmx";
Obtainorganizationinformation • // STEP 2: Retrieve the organization name and // endpoint URL from the CrmDiscoveryService • orgRequest =newRetrieveOrganizationsRequest(); orgResponse = (RetrieveOrganizationsResponse) discoveryService.Execute(orgRequest); • OrganizationDetailorgInfo = null; • foreach (OrganizationDetailorgDetail in orgResponse.OrganizationDetails) • { • if (orgDetail.OrganizationName.Equals(„Noser")) • { orgInfo = orgDetail; break; } • }
Obtainorganizationinformation • // STEP 3: Create and configure an instance of // the CrmService Web service. • token = newCrmAuthenticationToken(); token.AuthenticationType = 0; // See Microsoft.Crm.Sdk.AuthenticationTypetoken.OrganizationName = orgInfo.OrganizationName; crmService = newCrmService(); crmService.Url = orgInfo.CrmServiceUrl; crmService.CrmAuthenticationTokenValue = token; crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
Obtainorganizationinformation • // STEP 4: Invoke a CrmService Web service // method. • whoRequest = new WhoAmIRequest(); whoResponse = (WhoAmIResponse) crmService.Execute(whoRequest);
TIP 4: CRM Webservice Wrapper • Create a wrapper that use the CRM webservice and dynamically provides basic functions over entities like: • Create • Delete • Update
TIP 5: Hanging CRM Webservice • I cameacross a problem in Visual Studio 2008, wherebyitseemedto hang every time I added a web referencetothe CRM web service, andthentriedusing IntelliSense todiscovertheattributesof an entity. • Itturns out that a bug in theway Visual Studio 2008 handles large XML files (such asthe CRM WSDL file) causesthisbehaviour, andsimplydisabling XML commentgenerationforeachprojectsolvestheproblem.
The GPS WCF Service IVehicleData VehicleData BusinessLogic Dataset GPS Data
CRM Silverlight Applikation Vehicle IDNameTypeAge… Vehicle IDNameLongitudeLatitudeTimestamp Anzeigen DB Vehicle IDLatitudeLongitudeTimestamp Nodataset in silverlightwhatnow?
Reading vehicledata • // Generate the query • cols = new ColumnSet(); • cols.Attributes = new string[] { "new_name", "new_type" }; • query = new QueryExpression(); • query.EntityName = "new_vehicle"; • query.ColumnSet = cols;
Authentication 1/2 • // This is the KEY part... we inject the CRM// Authentication header.The Xml formater is// just to prevent some characters from being// encoded (otherwise CRM can't parse the// authentication token properly) • header = MessageHeader.CreateHeader ("CrmAuthenticationToken", "http://schemas.microsoft.com/crm/2007/WebServices", "", new MyCrmAuthenticationTokenSerializer(0, "NoserEngineeringAG", null));
Authentication 2/2 • // Insert SOAP header • OperationContext.Current = new OperationContext((IContextChannel)client.InnerChannel); • OperationContext.Current.OutgoingMessageHeaders.Add(header);
Serializationobject • <AuthenticationType • xmlns='http://schemas/crm/2007/CoreTypes'> • 0 • </AuthenticationType> • <OrganizationName • xmlns='http://schemas/crm/2007/CoreTypes'> • NoserEngineeringAG • </OrganizationName> • <CallerIdxmlns='http://schemas/crm/2007/CoreTypes'> • 00000000-0000-0000-0000-000000000000 • </CallerId>
With a “normal” project • // Set up the CRM service. • token = new CrmAuthenticationToken(); • token.AuthenticationType = 0; • token.OrganizationName = "NoserEngineeringAG"; • service = new CrmService(); • service.CrmAuthenticationTokenValue = token; • service.Credentials = System.Net.CredentialCache.DefaultCredentials;
TIP 6: Debugging • Fiddlerfreetouse
Silverlight and CRM 4.0 demo Martin Straumann Technologie Team Leader Noser Engineering AG
Summary • Use the „power“ of the new entity relationtypes • Try to use a CRM wrapper in bigger projects • Silverlight can have additional workflows
Want more programming tips? • Drop your business card in the pot and get more tips via email.
============================= noserengineeringag talackerstrasse 99 CH-8404 winterthur martinstraumann technologieteamleader Tel.: +41 (0)52 234 56 11 - zentrale Tel.: +41 (0)52 234 56 17 - direkt Mobil: +41 (0)78 707 32 23 Mail: martin.straumann@noser.com Infos: http://www.noser.com =============================