Gli strumenti di sviluppo e personalizzazione di Microsoft CRM 3.0 Marcello Fisicaro [email protected] Partner Technology Specialist Microsoft Italia CRM 3.0 Agenda Introduzione Personalizzazione “Data & Experience” Personalizzazione dei processi Developer Experience Reporting & Business Intelligence Q & A Introduzione CRM 3.0 Microsoft CRM | Integrato e completo Vendite Servizio Marketing Una completa soluzione di CRM che utilizza la potenza e la produtttività della piattaforma Microsoft. Adattabile al tuo modo di operare • Esperienza nativa Office e Outlook • Semplice e utilizzabile off-line Configurabile con il tuo business • Facilmente adattabile ai processi aziendali • Framework completamente personalizzabile • Motore di workflow e analitico Tecnologicamente avanzato • Gestione centralizzata e semplificata • Architettura SOA • Facile integrazione Architettura piattaforma Architettura di Microsoft CRM 3.0 Customization Points • Web services • • Callouts • • • Aggiungere entità e proprietà nuove Form customization • • Albero di navigazione Role based etc Schema customization • • Estendono le funzionalità dei Web Services e integrano logica di business customWorkflow Assemblies Estendono le funzionalità di Workflow UI customizations • • Permettono l’integrazione con altre piattaforme nonchè l’accesso a dati e logica di business di Microsoft CRM Personalizzare form, viste e integrare elementi UI Form events • Sviluppo attraverso gli eventi per aggiungere logica Personalizzazione “Data & Experience” CRM 3.0 Personalizzazioni strutture dati Personalizzazione schema estensiva • Creare/Rinominare entità, attributi, relazioni • Personalizzazione attività • Supporto per client Web e Offline Gestione schema efficente • Strumento all’interno del web client • Permessi più granulari • Pubblicazione personalizzazioni senza reset Schema Portability • Import/Export supportato anche per le nuove funzionalità Customer Benefit • Foundation per le soluzioni verticali • Riduce la necessità di coinvolgere l’IT • Distribuzione dei cambiamenti più semplice Personalizzazione dati Business design flessibile Design business forms e entità senza scrivere codice. Utilizzo dei termini del vostro business in forms, viste e report Sincronizza offline anche entità custom Creazione di una nuova entità Considerazioni Ownership Type • Organization / User Owned (es Product/Account) Entity Relationships • Primary/ Related Relationship (1 many/ many 1) • Cascading Behavior • Parental / referential / referential restricted / configurable cascading • • • Cascade all / active / user owned / none / remove link /restrict Actions: Assign/ Share/ Unshare/ Reparent/ Merge/ Delete Mappings Entity Security and Customizations Personalizzazione esperienza Flessibilità e supporto a soluzioni Form Scripting • Field Events: OnLoad, OnSave, OnChange • Metodi per accedere a client /attributi / state • Proprietà per ObjectID, Object Type Code Form Customization • Supporto IFrame • layout migliorato • Supporto upgrade per estensioni ISV registrate in ISV.config Navigation • Navigatione custom via SiteMap • Integrazione con entità custom • Consistenza fra web e Outlook • Estensioni al menu Outlook Customer Benefit • Foundation per soluzioni verticali • Minori costi per personalizzazione e upgrade • Esperienza personalizzata consistente CRM Form Designer • • • • • • Look della form Formato colonne Add/remove/move Fields/Tabs/Sections Eventi legati ai campi Add/configure IFrames Etichette CRM Form Object Model • Proprietà per accedere alle info della form aperta • Metodi che permettono l’invocazione di azioni sulla form • Sintassi: • crmForm.propertyname • Accesso ai campi della form • crmForm.all.{field_schema_name} CRM From Object Model Esempi //Setup variables var CRM_FORM_TYPE_CREATE = "1"; var CRM_FORM_TYPE_UPDATE = "2"; //Setup variables var CRM_ENTITY_ACCOUNT = 1; var CRM_ENTITY_CONTACT = 2; //Test the FormType and ObjectId properties: switch (crmForm.FormType) { case CRM_FORM_TYPE_CREATE: alert("This is a create form."); break; //Test the ObjectTypeCode property: switch (crmForm.ObjectTypeCode) { case CRM_ENTITY_ACCOUNT: alert("This is an Account form."); break; case CRM_FORM_TYPE_UPDATE: alert("This is an update form, the ID is " + crmForm.ObjectId); break; } case CRM_ENTITY_CONTACT: alert("This is a Contact form."); break; } Isv.config • • • Possibilità di personalizzare toolbars/ menu Export, Edit, Import Impostazioni viste anche da Outlook <configuration version="3.0.0000.0"> <Root> <ToolBar> <Button Title="XML Feeds" ToolTip="Guarda gli XML feed disponibili" Icon="/rss/rss.ico" Url="/rss/rss.aspx" WinMode="0" /> </ToolBar> </Root> <Entities> <Entity name="account" > Sitemap • Possibilità di personalizzare completamente la navigazione • Export, Edit, Import • Impostazioni viste anche da Outlook • Integrazione con le entità custom <SiteMap> <Area Id="Workplace" Title="Area di lavoro" ResourceId="Area_Workplace" ShowGroups="true" Icon="/_imgs/workplace_24x24.gif“ DescriptionResourceId="Workplace_Description"> <Group Id="MyWork" Title="Personale" ResourceId="Group_MyWork" DescriptionResourceId="My_Work_Description"> <SubArea Id="nav_activities" Overview strumenti di personalizzazione Es “integrazione con Mappoint service” Es nuova entità fornitore Area BI CRM 3.0 Personalizzazione dei processi Workflows CRM 3.0 Workflow Realizzazione di regole per automazione di processi Strumenti in base al profilo • Workflow Editor • Realizzazione di workflow (admin) • • Su attività Entità custom etc • Estensione di azioni/condizioni (dev) • Workflow Monitor (debbugger per admin) • Callout (dev) Strumenti di workflow per i processi di Business • • Workflow Editor • Creazione, modifica, impostazioni regole di workflow. Workflow Monitor • Status dei processi di workflow in corso Estensibilità – Nuove Azioni Creazione nuove Azioni / Condizioni Estensione del workflow con codice custom • • • • • Benefit .NET based Facile subscription e deployment Workflow manager support Integrazione con VS.NET & CRM Web Services Messaggi Rich context • Modellazione di processi ricca e flessibile Input Parameters Work flow Rule Managed Assembly Return Paramters Work flow Rule Estensione regole di Workflow Creazione di estensioni con assembly .NET Estensione regole di Workflow Creazione di estensioni con assembly .NET Modifica file workflow.config • Es: creazione di sito sharepoint collegato alla creazione di una opportunità <method name=“CreateSite" assembly=“Sharepoint.dll" typename=“Sharepoint.SiteCreator" methodname=“CreateSite“ group=“Sharepoint Functions”> <parameter name=“ID" datatype=“lookup“ entityname=“account”/> <parameter name=“Name" datatype=“string"/> </method> Extensibilità - Callout Estensioni attraverso logica custom • • • • • • Benefit .NET e basati su eventi Facile subscription e deployment Eventi POST e PRE Ricche informazioni contestuali Integrazione con Web Services CRM Sincroni e transazionali CRM Application • Costruzione di soluzioni fortemente integrate CRM Platform Method Pre-Callout CRM Tools CRM SDK Platform Core Operation Post-Callout Estensibilità - Callout • • Es: assembly.NET per tracciare cambiamenti di sconto e mandare messaggi di modifica .NET assembly per il calcolo dello sconto <callout.config version="3.0"> <callout entity="quote" event="PostUpdate"> <subscription assembly="MessagingPlugin.dll" class="MessagingPlugin.Messages"> <prevalue>discountpercentage</prevalue> <postvalue>discountpercentage</postvalue> <prevalue>totallineitemamount</prevalue> <postvalue>totallineitemamount</postvalue> </subscription> </callout> </callout.config> Pre-Callout • • • • Eventi Sincrono Parametri gestiti: PreCreate • • PreDelete PreUpdate Entity e User Context Attribute “influenzati” PreAssign Modifica dati “on the fly” Gestione controllo attraverso comandi Continue, Stop, Abort Entity Context User Context PreSetState PreMerge Attribute Set Platform Method Call Pre-Callout Component Return Code Custom Error Message Modified Attribute Set Post-Callout Eventi PostCreate • Sincrono • Informazioni ricche: • • PostUpdate PostDelete PostAssign Stato pre Stato post PostSetState PostMerge Entity Context User Context Platform Method Call Attribute Set (Pre-Image) Attribute Set (Post-Image) Post-Callout Component Return Code Callout Esempio di codice public class CalloutSample : CrmCalloutBase { // This function is called before an account is created. public override PreCalloutReturnValue PreCreate(CalloutUserContext userContext, CalloutEntityContext entityContext, ref string entityXml, ref string errorMessage) { ..... return PreCalloutReturnValue.Continue; } } Personalizzazione dei processi Processo di vendita Integrazione con sharepoint CRM 3.0 Developer Experience CRM 3.0 Developer Experience Integrazione con Visual Studio .NET • Supporto estensivo a IntelliSense • Classi e messaggi “Strongly typed” • Managed code development model Benefits • Sviluppo veloce e a basso costo. • Scrivi meno codice. SOA & Interoperabilità • WSDL e modello “platform independent” • Compliancy a Standard (WS-I BP V1.1) • Gestione dei web service semplice per tutte le entità • Facile integrazione con altre applicazioni Pieno supporto alle personalizzazioni • Generazione dinamica dei type (WSDL) • Seamless programming model • Supporto al Polimorfismo • Meno codice e più generico Microsoft CRM Web Services • • • • WSI, BP v1.1, WSDL, Single Endpoint Strongly typed .NET based CRM Web Service (CrmService.asmx) • Accesso ai dati di tutte le Entità (incluse entità custome e proprietà) • Esecuzione delle business op (business logic e op specializzate) • Metadata Web Service (MetadataService.asmx) • Accesso ai metadati del CRM Confronto fra Web Services V3.0 vs. V1.x V1.X Web Services Nuovi web services XML based (no type support) •Runtime errors Strongly typed •Design/Compile time errors •Core Entities and Properties •Custom Entities and Properties •Strongly typed child properties •Browse-able class hierarchy Precompiled static Proxy dlls Dynamically generated WSDL N Entities N Web Services Low scalability N Entities One Web Service High scalability No versioning Versioned schema and Web Service .NET only Dll based deployment Any platform WSDL with no deployment Low consistency High level of consistency on naming, types and operations support CrmService: Metodi comuni • Create • - System.Guid Create(BusinessEntity businessEntity) Crea un istanza di una qualsiasi entità • Retrieve • - BusinessEntity Retrieve(string bEName, Guid bEId, ColumnSet columnset) Ottiene una istanza di una entità già presente nel CRM • RetrieveMultiple - BusinessEntityCollection RetrieveMultiple (QueryBase queryBase) • Usa una query custom (QueryExpression) per ottenere risultati strongly typed • Update - void Update (BusinessEntity businessEntity) • Aggiorna una istanza di entità estitente nel CRM • Delete - void Delete (string bEName, Guid bEId ) • Cancella una istanza di entità dal CRM • Fetch - string Fetch (string FetchXML) • Usa una query custom (FetchXML) per ottenere risultati in formato XML (genericamente utilizzabile) Differenze: 1.2 vs 3 Creazione account e contatto String accountId = account.Create(userAuth, accountXml.ToString()); String contactId = contact.Create(userAuth, contactXml.ToString()); Guid actId = service.Create(act); Guid contId = service.Create(cont); Utilizzo di CrmService Esempio di Creazione di un Account // Set up the Web service. CrmService service = new CrmService(); service.Url = "http://<servername>/mscrmservices/2006/crmservice.asmx"; service.Credentials = System.Net.CredentialCache.DefaultCredentials; // Create an account entity and assign data to some attributes. account newAccount = new account(); newAccount.name = "Greg Bike Store"; newAccount.accountnumber = "123456"; newAccount.address1_postalcode = "98052"; newAccount.address1_city = "Redmond"; // Call the Create method to create an account. Guid accountId = service.Create(newAccount); Utilizzo di CrmService Esempio di codice per il controllo della duplicazione di un account CrmService service = new CrmService(); service.Credentials = System.Net.CredentialCache.DefaultCredentials; QueryByAttribute attributeQuery = new QueryByAttribute(); attributeQuery.Attributes = new string [] {"name"}; attributeQuery.Values = new string [] {newAccountName}; attributeQuery.EntityName = EntityName.account.ToString(); RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest(); retrieve.Query = attributeQuery; RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve); // Render the response to the caller if (retrieved.BusinessEntityCollection.BusinessEntities.Length > 0) { //duplicated found } else { //duplicated NOT found } Utilizzo di CrmMetadataService Esempio di codice per ottenere due array di entità custom e non // Retrieve the metadata and build two arrays, // one that contains core entities, // the other custom entities. MetadataService service = new MetadataService(); Metadata md = service.RetrieveMetadata(MetatDataFlag.Entities); ArrayList coreEntities = new ArrayList(); ArrayList customEntities = new ArrayList(); foreach (EntityMetadata em in md.Entities) { if (em.IsCustomEntity) customEntities.Add(em.name); else coreEntities.Add(em.name); } Building powerful applications DupDetection & Callout Integrazione con Windows Desktop Search Rss Feeds CRM 3.0 Reporting & BI CRM 3.0 Analisi dei dati con strumenti familiari ed efficaci Analisi del business immediata Report sui tuoi dati aggiornati “incontext” Pivot e grafici generati dinamicamente con Microsoft Excel Pianifica e distribuisci I report Reportistica integrata / cruscotti Accesso ai dati CRM da Office Reportistica: riassumendo... Strumenti di reportistica per diversi profili • Non più solo in area “Report” • Report pre filtrabili contestuali (nelle form, liste o area reporting) • Disponibili anche in Outlook • Strumenti disponibili per diversi profili • • • • • Viste – “My expiring cases”, “My accounts”, … Integrazione con Excel – PivotTable dinamiche SRS Reports – “Account Overview”, … Cruscotti aziendali con sharepoint Business Data Lookup Snap in per Office Report SRS: elementi chiave Reporting Services Server Report Request Reporting Services Report Request Query on Filtered View Secure CRM Data Database Great reports Report dinamici con Excel Esempio di report con RS Business Data Lookup Snap in Esempio di cruscotto con sharepoint CRM 3.0 Riassumendo • Microsoft CRM V3.0: • Fornisce un insieme di funzionalità di estensione e integrazione che permette la creazione di potenti applicazioni di business • Facilmente integrabile con applicazioni esterne attraverso Web services e XML • Ricca development experience Links utili • Crm SDK • • • • • • • • Downloadable Online GotDotNet Crm Sandbox Home “Microsoft Crm” Newsgroup “Microsoft Crm Developer” Newsgroup ”Microsoft Crm Deployment” Newsgroup Microsoft CRM DemoLab Blogs vari • Mid Atlantic Microsoft CRM Microsoft CRM V3.0 Q&A mailto: [email protected] CRM 3.0 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. • • • • • • • • • • • • • Mapping from Version 1.2 For the most part, Microsoft CRM 3.0 SDK is backward compatible with previous versions. This means that you can include the old DLLs from the previous version and your code will still work using the old programming style. There are a few exceptions: Activities. CRMActivity and CRMEmail proxy objects are not supported. Code written against these objects must be converted to the new programming model. Methods that create activities. This includes CRMSalesOrder.Cancel, CRMOpportunity.Lose, and CRMIncident.Close. Workflow. CRMProcess proxy object is no longer supported. It is recommended that all workflows be created using the Workflow Manager. Rich Client Sync. Use of the CRMRichClientSync proxy object is no longer supported. CRMCustomization. This class is no longer supported. Use the message InitializeFrom to transform entity instances. CRMSalesperson. This entity is no longer supported. Use systemuser instead. CRMAnswer. This entity is no longer supported. Teams security. Teams cannot own objects in Microsoft CRM 3.0. MakePrivate/MakePublic. These methods are no longer supported. Organization. The organization entity does not support Create, Delete, Enable, and Disable actions. Warning Microsoft CRM V1.x APIs located in the assemblies Microsoft.Crm.Platform.Proxy, Microsoft.Crm.Platform.Types and http://<server name>/mscrmservices/*.srf are deprecated and are considered obsolete. This means that these APIs may not be supported in future versions of Microsoft CRM. You should avoid the use of Microsoft CRM V1.X APIs and you are strongly encouraged to migrate and develop your applications using the Web services that are described in this version of the Microsoft CRM 3.0 SDK and the accompanying documentation. Upgrade unsupported 1.2 a 3 • Modifiche al DB • Qualsiasi modifica diretta a tabelle viste sp (es campi aggiunti alla AccountBase) • Integrazioni con DB • Accesso diretto • Personalizzazioni di Form • Modifiche dirette a Aspx, js, xml, css etc • Modifiche su IIS • Sviluppo custom non previsto in SDK