Martin Straumann Technologie Team Leader Noser Engineering AG.

Post on 23-Dec-2015

218 views 0 download

Tags:

transcript

XRM in practice and advanced topics

Martin StraumannTechnologie Team LeaderNoser 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:      martin.straumann@noser.comInfos:      http://www.noser.com =============================

Agenda

XRM Business-Example ServiceTime

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

Q&A

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

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

Forklift businesscase

Martin StraumannTechnologie Team LeaderNoser Engineering AG

demo

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

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

Architecture overview Windows Server 2008

SQL

Tracking Data

CRM

IIS

WCF GPS-Service

SilverlightVirtual Earth

CRMWebservice

CRM

SilverlightMap application

Virtual Earth

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

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

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

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

Vehicle entity & useraccount

Martin StraumannTechnologie Team LeaderNoser Engineering AG

demo

TIP 1: Using the Metadata 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: 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

Silverlight Map Application

Application architecture

GPS Data

CRM

Silverlight IIS

Page, XAML

BusinessLogic

IVehicleData

VehicleData

BusinessLogicDatas

et

Using the CRM webservice

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

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

}

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;

Obtain organization information // 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:

CreateDeleteUpdate

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.

The GPS WCF Service

GPS Data

IVehicleData

VehicleData

BusinessLogicDatas

et

Creating the database

No dataset in silverlight what now?

Vehicle

IDNameTypeAge…

Vehicle

IDLatitudeLongitudeTimestamp

Anzeigen

Vehicle

IDNameLongitudeLatitudeTimestamp

CRM

DB

Silverlight Applikation

The silverlight application

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;

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 headerOperationContext.Current = new OperationContext((IContextChannel)client.InnerChannel);OperationContext.Current.OutgoingMessageHeaders.Add(header);  

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> 

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

Fiddler free to use

Silverlight and CRM 4.0

Martin StraumannTechnologie Team LeaderNoser Engineering AG

demo

Summary

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

Want more programming tips?

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

Questions

=============================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:      martin.straumann@noser.comInfos:      http://www.noser.com =============================