cub-e.net

just coding...

Mobile Development Helper Code for Dynamics CRM

Technologies

Web Services, OData, Dynamics CRM, SOAP
OData, Microsoft Dynamics CRM Modern app SOAP endpoint, Dynamics CRM web services
Desktop, Phone, Windows RT
en-US
9/8/2014

Introduction

The Microsoft.Crm.Sdk.Mobile source code sample is a partial re-implementation of the Microsoft Dynamics CRM SDK classes written as a Portable Class Library to facilitate development of store apps for Windows 8.1 desktop, tablets, and phones. The code makes use of the SOAP and OData protocols to issue web service method calls. An organization web service proxy and most of the message response/request classes in the CRM SDK have been implemented. When writing apps that use this code, you don’t have to link to the CRM SDK assemblies to access the organization web service.

This code can also be used when you develop apps using Xamarin. However, you must comment out the EnableProxyTypes method in Microsoft.Xrm.Sdk.Samples.cs when developing iOS or Android apps using Xamarin because that method contains code that is specific to Windows Store. An alternative is to comment out the relevant code as shown here.

 

Copy code
C#
Edit|Remove
public async Task EnableProxyTypes()
{
    List<TypeInfo> typeList = new List<TypeInfo>();
    //// Obtain folder of executing application.
    //var folder = Package.Current.InstalledLocation;
    //foreach (var file in await folder.GetFilesAsync())
    //{
    //    // Not only .dll but .exe also contains types.
    //    if (file.FileType == ".dll" || file.FileType == ".exe")
    //    {
    //        var assemblyName = new AssemblyName(file.DisplayName);
    //        var assembly = Assembly.Load(assemblyName);
    //        foreach (TypeInfo type in assembly.DefinedTypes)
    //        {
    //            // Store only CRM entities.
    //            if (type.BaseType == typeof(Entity))
    //                typeList.Add(type);
    //        }
    //    }
    //}
    typeList.Add(typeof(ActivityParty).GetTypeInfo());
    typeList.Add(typeof(SavedQuery).GetTypeInfo());
    typeList.Add(typeof(Privilege).GetTypeInfo());
    typeList.Add(typeof(SystemUser).GetTypeInfo());
    typeList.Add(typeof(Annotation).GetTypeInfo());
    typeList.Add(typeof(TimeZoneDefinition).GetTypeInfo());
    types = typeList.ToArray();
}
 

 

Building the Sample

Your development computer must have an internet connection to build the library as a NuGet package named Json.NET will be automatically downloaded during the build.

To build the Microsoft.Crm.Sdk.Mobile.dll assembly, follow these steps.

  1. In Visual Studio 2013, with update 2 or later installed, load the Microsoft.Crm.Sdk.Mobile.sln file.
  2. Press F6.

 

Description

The Microsoft Dynamics CRM 2013 SDK (and earlier releases) support client and server side code development for Dynamics CRM. However, the SDK assemblies cannot be used to develop mobile and store applications as the Windows run-time (WinRT) is not supported. To provide support for mobile apps, including cross platform iOS and Android apps, the Dynamics CRM server now supports client access to the organization web service using industry standard protocols such as OAuth (for authentication), plus SOAP and OData for sending web service requests. The problem is that while these protocols are supported, they are difficult to use. The solution is to layer a framework on top of the protocols to make app programming easier. For developing mobile and store apps, you can use the Microsoft Azure Active Directory Library (ADAL) for authentication, and this sample helper code library for web service requests and early-bound type support. 


What is included in the library

This library contains the following key components:

 

  Web Service Proxy

This library provides most methods that the OrganizationServiceProxy class in the CRM SDK does - Create, Update, Assign, Execute, and so on. The class supports early-bound development by providing an EnableProxyTypes method. SOAP implementations of these methods use the same name as are used in the CRM SDK while the OData-based methods have names that begin with “Rest” for example RestCreate.

 

  SDK classes and enumerations

This library supports most common CRM SDK classes and enumerations. With the addition of early-bound type support, you can use Visual Studio IntelliSense when writing your apps.

 

  Organization web service messages

This library includes request/response classes for over 200 messages. It covers both data operations, for example Create, and metadata operations, for example RetrieveMetadataChanges.

 

What isn't included in the library

Several functional areas that the library doesn’t cover are as follows:

Authentication

Since this sample code library targets multiple platforms, and each platform has its unique way to authenticate the user, the library doesn’t provide any authentication mechanism. You must obtain an OAuth access token and pass it to an OrganizationDataWebServiceProxy object to access the organization web service. It’s recommended that you use the Microsoft Azure Active Directory Authentication Library (ADAL) for identity authentication. This library is referenced in the CRM SDK documentation and sample code. There is an open source implementation of ADAL available for iOS and Android. There is a Windows 8.1 version available for the desktop, tablets, and phones.

For more information on ADAL see http://www.cloudidentity.com/blog/2014/06/16/adal-for-windows-phone-8-1-deep-dive.

A sample code file named CRMHelpers.cs is provided to demonstrate how to authenticate a universal app. The file is not included in the build of the library.

DiscoveryService, DeploymentService, OrganizationServiceContext

This library doesn’t provide support for the discovery or deployment web services. It also doesn’t support the OrganizationServiceContext class.

How to write apps that use this library

You can build Microsoft.Crm.Sdk.Mobile.dll using the supplied Visual Studio 2013 solution and add a reference for it in your app’s project or you can add the library’s C# sample code files to your project.

In your app, add code to authenticate the user and obtain a security access token. The method used varies depending on platform as mentioned previously. Next, instantiate the OrganizationDataWebServiceProxy class.

Copy code
C#
Edit|Remove
OrganizationDataWebServiceProxy _proxy = new OrganizationDataWebServiceProxy();
 

Set the access token and web server URL in the OrganizationDataWebServiceProxy object.

Copy code
C#
Edit|Remove
_proxy.ServiceUrl = "<your CRM server URL goes here>";
_proxy.AccessToken = "<access token>";
 

Call EnableProxyTypes to use early-bound types and optionally assign a service time-out interval.

Copy code
C#
Edit|Remove
await _proxy.EnableProxyTypes();

_proxy.Timeout = 600;

Send a message request to the web service by using an async/await pattern.

Copy code
C#
Edit|Remove
WhoAmIResponse whoAmIResponse = (WhoAmIResponse)await _proxy.Execute(new WhoAmIRequest());

// Retrieve User Info

SystemUser user = (SystemUser)await _proxy.Retrieve(SystemUser.EntityLogicalName, whoAmIResponse.UserId, new ColumnSet(true));
 

How to update existing application code

If you want to use existing application code that was written for the CRM SDK with this library, make the following code changes.

1. Add the async keyword to methods.

2. Add await before the call to a proxy method.

3. When accessing the property of a web service response, do so as shown here.

 

Original CRM SDK code

Copy code
C#
Edit|Remove
_proxy.RetrieveMultiple(new QueryExpression(“account”, new Columns(true)).Entities)
 

Modified code

Copy code
C#
Edit|Remove
(await _proxy.RetrieveMultiple(new QueryExpression(“account”, new Columns(true))).Entities)
 

Important notes

  • The sample files are not intended to be used in a production environment. You should deploy this sample to a test environment and examine it for interaction or interference with other parts of the system.
  • Before you deploy this sample to a production environment, make sure that you consider the existing customizations you may have implemented in Microsoft Dynamics CRM 2013.
  • This library was written by Kenichiro Nakamura at Microsoft.

Source code for the CrmSvcMobileUtil program is provided in a separate sample. Use that program to generate any custom or customized entity types in your organization for inclusion in your application.

Source Code Files

  • Microsoft.Xrm.Sdk.Utility.Samples.cs - This file implementes a utility class that provides methods used by the other code files. There is no equivalent for this functionality in the CRM 2013 SDK.


More Information

For more information on Dynamics CRM authentication and app development, see Write mobile and modern apps.

download the code : View this sample online

Microsoft Dynamics CRM 2015 – Vega

Microsoft today has shared some information on Microsoft Dynamics CRM Fall Wave release – codenamed Vega as part of the Microsoft Dynamics roadmap 2014/2015. There are 3 other releases as part of CRM 2015 (Q4 2014) Fall wave release. These are: 1) code name Hydra: Microsoft Social Listening, 2) Electra: Microsoft Dynamics Marketing and 3) Phoenix: Parature (Dynamics CRM Integration with Parature) as shown in the below Microsoft Dynamics CRM road map (for 2014 and 2015).


Microsoft Dynamics CRM 2014/2015 Roadmap

More details about these 3 other releases will be in future posts.

As for Dynamics CRM Vega, this is a release focusing on Microsoft Dynamics CRM Core product. The Fall Wave release Vega applies to both CRM Online and CRM On-Premise.

So Vega is apparently going to be officially named: CRM 2015. It will be released before end of this year (Q4 2014). It is expected to include some core product features in Dynamics CRM that many have been waiting for!
New features and enhancements in Vega Dynamics CRM 2015 are:

Business Process Improvements:

  • Rule-based branching
  • Single Edit experience
  • Support for multiple entity loops
  • Programmability through Client API
  • Active processes
  • Change of currently active process
  • Move Stages
  • Stage selection and Changing of currently active stage

User Experience Improvements:

  • Multi Entity Search Capability (horraayy!)
  • A new Advanced Search Button
  • Nested Quick Create forms

Mobility Features:

  • The addition of 29 new Languages
  • More Dashboards and new concept of Home-pages
  • Support of “Any Device”
  • Ability to have offline drafts

Enterprise Sales Features:

  • Entity Hierarchy
  • Cross-sell and Up-sell capabilities (also know as Next Buy Actions)
  • External Pricing features
  • Attribute Inheritance
  • Product Relationship
  • Bundles

XRM and Development Advances:

  • Complex calculations (Calculated Fields & Roll-up of values) (Yes!)
  • Hierarchical Relationship Property
  • Ability to query multiple entities
  • Hierarchical Security Models
  • Field Level Security for system fields (out of the box fields)

Analytics and Business Intelligence Enhancements:

  • Power BI in CRM Web client
  • Transactional reporting of CRM on Windows Mobile Client Application
  • Roll up on different fields across hierarchie

Specific for CRM Online (Microsoft’s Online First motto):

  • Self-Service
  • Sign up process Simplification
  • Global Expansion from 42 to 61 Markets (Latin America data centre)
  • Multi-Geographical tenants
  • Scaling out Organisation Synchronisation
  • Minimal downtime Upgrades
  • Addition of Load balancing

Supported OS and Software Requirements:

  • Windows Server –2012 & 2012 R2
  • Windows Client – Vista, Windows 7 & Windows 8
  • ADFS – 2.0, 2.1, 2.2
  • SQL Server – 2012
  • Exchange Server –2010 & 2013
  • Outlook – 2010 & 2013

Software and OS no longe supported:

  • Windows Server 2008 & 2008 R2
  • SQL server 2008 & 2008R2
  • Windows Small Business Server ( all version )
  • 2008 Series Terminal Servers
  • Windows Vista
  • SharePoint 2007
  • Exchange 2007
  • IE 8, IE 9
  • Office 2007

This post has content from this Dynamics Community post

CRM Service Utility for Mobile Development

Technologies

Dynamics CRM
Code Generation, Dynamics CRM metadata access
Desktop, Phone, Windows RT
en-US
9/8/2014

Introduction

This sample is a custom extension to the CrmSvcUtil.exe program that ships in the Dynamics CRM 2013 SDK. The purpose of this program is to generate C# or VB source code containing early-bound entity types and option set types from the metadata of your CRM server. This code can then be included in your mobile app projects. This enables you to make use of both out-of-box and any custom or customized entities in your code.

 

Building the Sample

To build the program, follow these steps.

  1. Obtain the CrmSvcUtil.exe program and the Microsoft.Xrm.Sdk.dll assembly from the Bin folder of the CRM 2013 SDK. You can download the SDK from http://msdn.microsoft.com/en-us/dynamics/crm/dn467921.aspx.
  2. Load the CrmSvcMobileUtil.sln solution file into Visual Studio 2013.
  3. Add references to CrmSvcUtil.exe and Microsoft.Xrm.Sdk.dll in the project.
  4. Press F6 to build the program.

 

Running the Program

For information on how to run the program, see the SDK topic: Create early bound entity classes with the code generation tool (CrmSvcUtil.exe).

 

Important Notes

    • The sample files are not intended to be used in a production environment. You should deploy this sample to a test environment and examine it for interaction or interference with other parts of the system.
    • This program was written by Kenichiro Nakamura at Microsoft.

       

      More Information

      For more information about writing an extension to the CrmSvcUtil program, see Create extensions for the code generation tool.

      You can download code:

      CRM Service Utility for Mobile Development.zip (48.2KB)

      Our new product : MawensEdu School Management System

      MawensEdu has been developed over Microsoft Dynamics CRM 2013 and it is a school management system which uses Dynamics CRM’s advanced sales and marketing capabilities. 

      With MawensEdu, you can organize SMS and e-mail campaigns, and you can easily follow your campaign budget as well as your campaign goals. 

      During the sales process, you can create offers for more than one section/school and you can supervise the activities of your worldwide vendors.  

      Inside the School, Student/Teacher, and Classroom – Extracurricular activities can be planned, timetables and attendance charts also can be managed. MawensEdu is an independent platform.

      It’s compatible with Mac, Windows and Tablets (iPad, Android). You can manage your business from any device and anywhere you want because it’s web-based application.

      You do not need any additional software for your device to use its all features. 

      Create suitable Campaign Objectives with powerful analysis tools

      You can easily analyse your data and start e-mail and SMS campaigns for your leads after entering their data obtained from fairs or promotional events. In this way, with minimum cost, you will reach maximum audience who will respond your campaign.

      Also, advanced reporting tools can keep under control your campaign at any time. Objective/cost reports will guarantee the success of your campaign.

      Ensure the sales team to achieve their objectives

      MawensEdu, provides you great tools that makes you able to keep under control the whole process of prospective student, from the first encounter until the sale ends.

      When a registration occurs or updated over MawensEdu, you can obtain results according to each case through the triggered workflow mechanism. 

      For example, a visitor visited your website and filled out the information form. Through the workflow mechanism, this information will fall in front of a dealer and this sale activity can be followed on the system. The system will keep record of all the conversation happened via email, phone or face-to-face between the student and the dealer. 

      The software wizard can help you to give suitable offers for the correct students. In addition, after the completion of sale, the system will take care of placement of the relevant student - payment tracking and, if necessary, picking up from the airport and the accommodation and all these relevant stages can also be followed up through the system.   

      Manage your own school…

      After the sales progress, you can keep track of any course registered by your students and the lectures included in the courses, also your student’s attendance status can be followed. 

      System allows you to save all the course contents and the topics of the current lessons. By this way, you can keep track which teacher and student had what lecture in which classroom on what day/what time; also which materials and study methods had been used. 

      Also system can report about each student, what is the aim of the course and how successful students are at assignments and examinations.  

      System is flexible so it allows you to make changes quickly about the content of a course or urgent teacher replacements.

      The system will allow you to manage school equipment and their planned repair / maintenance activities.

      Timetables and content of Diploma and Certificate programmes can also be planned on the system.

      360 degree view will enable you to keep track of a student on a single screen - starting from the sales process until accommodation, attendance, exam notes, payment tracking and control of the assignments.

      Inside the School, Student/Teacher, and Classroom – Extracurricular activities can be planned, timetables and attendance charts also can be managed. 

      Apart from all these, you can plan inspection dates performed by the external institutions and you can manage the documents you need to submit during these inspections. These activities can be planned under management and teacher role, also can follow up if task have been completed. 

      You can use application online or on-promise.

      Login screen :


      Sample Course Program :

      Sample Schema of Work:

      Sample Lesson Plan:

      iPad Screen 1:

      iPad Screen 2:

      iPad Screen 3:

      CRM 2013 Quick Start - Jumpstart your CRM 2013 learning curve

      I would like to introduce a new CRM book which you can access ebook version from that website www.crm2013quickstart.com

      Discount: JulieYackCRMQuickStartEBook (20% off the ebook)

      The CRM 2013 Quick Start is a first look at Microsoft Dynamics CRM 2013 and all the new features that have been included. 

      In the CRM 2013 Quick Start you will find details that can help administrators, customizers (functional consultants) and developers; not to mention power business users wanting to know all the details the admin never tells them. If you run CRM in the cloud or sitting in a server room at your office the information is useful. 

      This book is targeted to someone who has some CRM prior experience. By that we simply don’t spend any time explaining the basics of Microsoft Dynamics CRM from a beginner’s point of view. That said, the information in this book would still be useful on your journey to become proficient. 

      Chapter 1 - Hello I’m CRM 2013

      Microsoft Dynamics CRM 2013 is a major release building on the strong foundation of CRM 2011. From the user experience to platform capabilities CRM 2013 has changes that are targeted for everyone as users, customizers, IT Pros, and developers. In this chapter we give you a 50,000 foot tour of what’s new.

      Chapter 2 – The User Experience

      Before you can build solutions in CRM 2013 you should learn how the new user experience works. In this chapter we will dive into the new experience and break down all the key changes so you are ready to start thinking about customizing it.

      Chapter 3 – Customizing CRM Forms

      The 2013 user experience requires rethinking how we customize forms. From the new layout options, new controls and even new form types we have a lot to talk about. We also can’t forget you might have CRM 2011 forms and want to know how to move them forward into this release.

      Chapter 4 – Security Model Changes

      Today’s global business challenges the traditional organization structure as people form dynamic teams to work on individual opportunities or other data in CRM. CRM 2013 addresses that with Access Teams which challenge past thinking of how to handle these types of needs. In this chapter we will explore the new feature and discuss how and when to use the different CRM security concepts.

      Chapter 5 – Building Business Processes

      To consistently bake good cookies people often times use their favorite recipe. The Business Process feature of CRM 2013 brings that to CRM allowing you to bake in a business process into the life cycle of a CRM record. In fact you can even blur the lines of multiple CRM entities and have a business process cross the entity boundaries reflecting more real-world business processes. In this chapter we look at the features and how to leverage them to improve user productivity and consistency.

      Chapter 6 – No Code Business Rules

      Portable Business Rules, or PBL for short, offer a declarative way to define business rules. This new feature represents the start of a journey to a common need of having simple rules like “This field is required”. In this chapter we will explore the capability of PBL and when to use it versus other concepts in CRM that can enforce business rules.

      Chapter 7 – Real Time Workflows

      Workflows offer an easy way to compose flexible business processes that can optionally include custom code created by a developer. Prior to CRM 2013 these had to run asynchronously in the background and never could happen in real time. This caused a lot of plug-ins to be built to handle the requirement. New in CRM 2013 is real time workflows that can allow processing of events real time. In this chapter we discuss when and how to use the new feature.

      Chapter 8 – Upgrading to CRM 2013

      Next, Next, Next…Done… If it was only that easy it would be an automated upgrade. In this chapter we explore what you should consider before you upgrade and how to prepare.

      Chapter 9 – Solutions going forward

      As the pace of CRM releases increases, understanding how to package and deploy solutions becomes increasingly important. In this chapter we will discuss changes to the Solution Framework and how to prepare for the bold new world of frequent CRM releases.

      Chapter 10 – Taking CRM on the Road

      There is no question Microsoft was behind in mobile applications for CRM but came back strong with the introduction of the new tablet application for IPad and Windows. Learn how this fits in with the customizations you are doing to CRM and limitations you should be aware of in this first generation release. This chapter will also cover Outlook enhancements and Server Sync that in many scenarios will free the deployment from having an E-mail router.

      Chapter 11 – Developers, Developers, and Developers

      This release doesn’t have huge new API changes but it does have a lot of small useful changes across the different parts of the developer features. In this chapter we will explore from oAuth authentication support to Custom Actions and all the little changes between them.