42
XRM in practice and advanced topics Martin Straumann Technologie Team Leader Noser Engineering AG

Martin Straumann Technologie Team Leader Noser Engineering AG

Embed Size (px)

Citation preview

Page 1: Martin Straumann Technologie Team Leader Noser Engineering AG

XRM in practice and advanced topics

Martin StraumannTechnologie Team LeaderNoser Engineering AG

Page 2: 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.

=============================noser engineering agtalackerstrasse 99CH-8404 winterthur martin straumanntechnologie team leader Tel.:       +41 (0)52 234 56 11    - zentraleTel.:       +41 (0)52 234 56 17    - direktMobil:   +41 (0)78 707 32 23Mail:      [email protected]:      http://www.noser.com =============================

Page 3: Martin Straumann Technologie Team Leader Noser Engineering AG

Agenda

XRM Business-Example ServiceTime

Extracted democase exampleEntity customizationExternal crm data handlingCustom object integration with silverlight & microsoft virtual earth

Q&A

Page 4: Martin Straumann Technologie Team Leader Noser Engineering AG

XRM Business-Example

• 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

ServiceTime is an integrated fleet- and service management solution for order entry, service disposition and tracking in an ERP system.

GSM / UMTS

Page 5: Martin Straumann Technologie Team Leader Noser Engineering AG

Resource Database

Micro

soft D

ynam

ics CR

M/N

AV

/AX

or

oth

er B

acke

nd LO

B A

pplica

tions

Backend Connect

or

Staging Database

Reference Database

SSISSQL Server

Merge Replication

SQL Server CE Merge

Replication

ServiceTime

Mobile

Sale

s

Mobile

Serv

ice

Document Service

Deployment Service

Logging Service

Tracking Service

Mobile Client Mobile Business Integration Server Backend Solution

ServiceTime in combination with Microsoft Dynamics Mobile Development Tools

Microsoft SQL Server component Server Connector and Integration Objects Backend Business Solution

CRM 3.0

CRM 4.0

Page 6: Martin Straumann Technologie Team Leader Noser Engineering AG

Forklift businesscase

Martin StraumannTechnologie Team LeaderNoser Engineering AG

demo

Page 7: Martin Straumann Technologie Team Leader Noser Engineering AG

Resource Database

Micro

soft D

ynam

ics CR

M 4

.0

Backend Connect

or

Staging Database

Reference Database

SSISSQL Server

Merge Replication

SQL Server CE Merge

Replication

ServiceTime

Mobile

Sale

s

Mobile

Serv

ice

Document Service

Deployment Service

Logging Service

Tracking Service

Mobile Client Mobile Business Integration Server Backend Solution

Page 8: Martin Straumann Technologie Team Leader Noser Engineering AG
Page 9: Martin Straumann Technologie Team Leader Noser Engineering AG

Extracted case example

Showing the location of CRM resources on a virtual earth map

Using defined vehicle resources from CRMMap integration in CRM with SilverlightIntegration of GPS position from an external WCF service

Page 10: Martin Straumann Technologie Team Leader Noser Engineering AG

Architecture overview Windows Server 2008

SQL

Tracking Data

CRM

IIS

WCF GPS-Service

SilverlightVirtual Earth

CRMWebservice

CRM

SilverlightMap application

Virtual Earth

Page 11: Martin Straumann Technologie Team Leader Noser Engineering AG

What do we need?

CRMCustom vehicle entityTestuser accountCustom site for the Silverlight application

SilverlightVirtual Earth component and vehicle componentCRM webserviceWCF-Service of the GPS tracking

GPS Tracking WCF-ServiceSQL database with the GPS dataWCF-Service with it logic

Page 12: Martin Straumann Technologie Team Leader Noser Engineering AG

Overview of customization typesCustomization

typeWeb service access

Entities, attributes and relationships

Stored in metadata, Edited using MetadataService

Forms, views and icons

Stored in CRMService.organizationui, Retrieved by CRMService

System view Stored in CRMService.savedquery, Edited by CRMService

Entity mappings Stored in CRMService.entitymap, Edited by CRMService

Attribute mappings

Stored in CRMService.attributemap, Edited by CRMService

Message Stored in CRMService.displaystring, Edited by CRMService

Site Map Available by import and export messages in CRMWervice

ISV Configuration Available by import and export messages in CRMWervice

Page 13: Martin Straumann Technologie Team Leader Noser Engineering AG

Entity relationships in CRM 3.0 CRM 3.0 Entity

RelationshipsOne-to-Many System-CustomOne-to-Many Custom-Activity/NoteOne-to-Many Custom-CustomOne-to-Many Custom-SystemCustom-Custom

Page 14: Martin Straumann Technologie Team Leader Noser Engineering AG

Entity relationships in CRM 4.0 Additional

CRM 4.0 Entity RelationshipsOne-to-Many System-SystemSelf-ReferentialMultiple Relationships Between EntitiesMany-to-Many System-System, System-Custom & Custom-Custom

Page 15: Martin Straumann Technologie Team Leader Noser Engineering AG

Vehicle entity & useraccount

Martin StraumannTechnologie Team LeaderNoser Engineering AG

demo

Page 16: Martin Straumann Technologie Team Leader Noser Engineering AG

TIP 1: Using the Metadata Browser

http://yourservername[:port]/yourorganizationname/sdk/list.aspx

Page 17: Martin Straumann Technologie Team Leader Noser Engineering AG

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.

Page 18: Martin Straumann Technologie Team Leader Noser Engineering AG

TIP 3: Sitemap error

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

Page 19: Martin Straumann Technologie Team Leader Noser Engineering AG

Silverlight Map Application

Page 20: Martin Straumann Technologie Team Leader Noser Engineering AG

Application architecture

GPS Data

CRM

Silverlight IIS

Page, XAML

BusinessLogic

IVehicleData

VehicleData

BusinessLogicDatas

et

Page 21: Martin Straumann Technologie Team Leader Noser Engineering AG

Using the CRM webservice

Page 22: Martin Straumann Technologie Team Leader Noser Engineering AG

Obtain organization information // STEP 1: Instantiate and configure the// CrmDiscoveryService Web service.discoveryService = new rmDiscoveryService(); discoveryService.UseDefaultCredentials = true; discoveryService.Url = "http://localhost/MSCRMServices/2007/AD/CrmDiscoveryService.asmx";

Page 23: Martin Straumann Technologie Team Leader Noser Engineering AG

Obtain organization information // STEP 2: Retrieve the organization name and // endpoint URL from the CrmDiscoveryService orgRequest =new RetrieveOrganizationsRequest(); orgResponse = (RetrieveOrganizationsResponse) discoveryService.Execute(orgRequest); OrganizationDetail orgInfo = null; foreach (OrganizationDetail orgDetail in orgResponse.OrganizationDetails) {

if (orgDetail.OrganizationName.Equals(„Noser")) { orgInfo = orgDetail; break; }

}

Page 24: Martin Straumann Technologie Team Leader Noser Engineering AG

Obtain organization information // STEP 3: Create and configure an instance of // the CrmService Web service.

token = new CrmAuthenticationToken(); token.AuthenticationType = 0; // See Microsoft.Crm.Sdk.AuthenticationType token.OrganizationName = orgInfo.OrganizationName;

crmService = new CrmService(); crmService.Url = orgInfo.CrmServiceUrl; crmService.CrmAuthenticationTokenValue = token; crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;

Page 25: Martin Straumann Technologie Team Leader Noser Engineering AG

Obtain organization information // STEP 4: Invoke a CrmService Web service // method.

whoRequest = new WhoAmIRequest(); whoResponse = (WhoAmIResponse) crmService.Execute(whoRequest);

Page 26: Martin Straumann Technologie Team Leader Noser Engineering AG

TIP 4: CRM Webservice Wrapper

Create a wrapper that use the CRM webservice and dynamically provides basic functions over entities like:

CreateDeleteUpdate

Page 27: Martin Straumann Technologie Team Leader Noser Engineering AG

TIP 5: Hanging CRM Webservice

I came across a problem in Visual Studio 2008, whereby it seemed to hang every time I added a web reference to the CRM web service, and then tried using IntelliSense to discover the attributes of an entity.It turns out that a bug in the way Visual Studio 2008 handles large XML files (such as the CRM WSDL file) causes this behaviour, and simply disabling XML comment generation for each project solves the problem.

Page 28: Martin Straumann Technologie Team Leader Noser Engineering AG

The GPS WCF Service

GPS Data

IVehicleData

VehicleData

BusinessLogicDatas

et

Page 29: Martin Straumann Technologie Team Leader Noser Engineering AG

Creating the database

Page 30: Martin Straumann Technologie Team Leader Noser Engineering AG

No dataset in silverlight what now?

Vehicle

IDNameTypeAge…

Vehicle

IDLatitudeLongitudeTimestamp

Anzeigen

Vehicle

IDNameLongitudeLatitudeTimestamp

CRM

DB

Silverlight Applikation

Page 31: Martin Straumann Technologie Team Leader Noser Engineering AG

The silverlight application

Page 32: Martin Straumann Technologie Team Leader Noser Engineering AG

Reading vehicle data

// Generate the query

cols = new ColumnSet();cols.Attributes = new string[] { "new_name", "new_type" }; query = new QueryExpression();query.EntityName = "new_vehicle";query.ColumnSet = cols;

Page 33: Martin Straumann Technologie Team Leader Noser Engineering AG

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)); 

Page 34: Martin Straumann Technologie Team Leader Noser Engineering AG

Authentication 2/2

// Insert SOAP headerOperationContext.Current = new OperationContext((IContextChannel)client.InnerChannel);OperationContext.Current.OutgoingMessageHeaders.Add(header);  

Page 35: Martin Straumann Technologie Team Leader Noser Engineering AG

Serializationobject

<AuthenticationTypexmlns='http://schemas/crm/2007/CoreTypes'>0

</AuthenticationType><OrganizationName

xmlns='http://schemas/crm/2007/CoreTypes'>NoserEngineeringAG

</OrganizationName><CallerId xmlns='http://schemas/crm/2007/CoreTypes'>

00000000-0000-0000-0000-000000000000</CallerId> 

Page 36: Martin Straumann Technologie Team Leader Noser Engineering AG

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;

Page 37: Martin Straumann Technologie Team Leader Noser Engineering AG

TIP 6: Debugging

Fiddler free to use

Page 38: Martin Straumann Technologie Team Leader Noser Engineering AG

Silverlight and CRM 4.0

Martin StraumannTechnologie Team LeaderNoser Engineering AG

demo

Page 39: Martin Straumann Technologie Team Leader Noser Engineering AG

Summary

Use the „power“ of the new entity relationtypesTry to use a CRM wrapper in bigger projectsSilverlight can have additional workflows

Page 40: Martin Straumann Technologie Team Leader Noser Engineering AG

Want more programming tips?

Drop your business card in the pot and get more tips via email.

Page 41: Martin Straumann Technologie Team Leader Noser Engineering AG

Questions

Page 42: Martin Straumann Technologie Team Leader Noser Engineering AG

=============================noser engineering agtalackerstrasse 99CH-8404 winterthur martin straumanntechnologie team leader Tel.:       +41 (0)52 234 56 11    - zentraleTel.:       +41 (0)52 234 56 17    - direktMobil:   +41 (0)78 707 32 23Mail:      [email protected]:      http://www.noser.com =============================