271 Friday, May 20, 2016 |
Suresh Maurya
Dynamics CRM Consultant at IBM

Retrieve Records In Dynamics CRM Using FetchXML

Following example demonstrates how to retrieve records in dynamics crm using FetchXML.

Connection string

<connectionStrings>
<add name="connection" connectionString="Url=https://org.crm.dynamics.com; Username=user@org.onmicrosoft.com; Password=password;"/>
</connectionStrings>

C# 

using Microsoft.Xrm.Client.Services;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;

namespace CrmSampleCodes
{
class Program
{
static void Main(string[] args)
{
IOrganizationService _service = new OrganizationService("connection");

// Create query using FetchXML.
string fetch = @"
<fetch mapping='logical'>
<entity name='account'>
<attribute name='accountid'/>
<attribute name='name'/>
</entity>
</fetch>";

EntityCollection retrieved = _service.RetrieveMultiple(new FetchExpression(fetch));
System.Console.WriteLine("Query Using FetchExpression");
System.Console.WriteLine("===============================");

// Iterate through returned collection.
foreach (var c in retrieved.Entities)
{
System.Console.WriteLine("Name: " + c.Attributes["name"]);
}
System.Console.WriteLine("===============================");
}
}
}

New content for CRM 2016 spring wave

The CRM 2016 spring wave includes many new and exciting features! 

The official names for the spring wave releases are:

  • Microsoft Dynamics CRM Online 2016 Update 1 and Microsoft Dynamics CRM 2016 Service Pack 1
  • Microsoft Dynamics Marketing 2016 Update 1
  • Microsoft Social Engagement 2016 Update 1.5

Microsoft Dynamics CRM

What’s new (all features)

Field service

Project service

CRM portals

Mobile offline

Power BI

Subscription and release history

For developers

Microsoft Dynamics Marketing

Microsoft Social Engagement

Quick references

Retrieve a Record In Microsoft Dynamics CRM Using Early Bound

Retrieve Method

To retrieve a single record use IOrganizationService.Retrieve(String, Guid, ColumnSetmethod.

Parameters

Name Type Comment
entityName String Logical name of entity
id Guid Guid of record to retrieve 
columnSet Microsoft.Xrm.Sdk.Query.ColumnSet Columns to retrieve 

Output

Microsoft.Xrm.Sdk.Entity

This method is implemented by OrganizationService class and OrganizationServiceContext generated in previous chapter.

Using Early Bound

All classes in early-bound entity classes (generated in earlier chapter) has a EntityLogicalName property which returns logical name of entity. 

Account.EntityLogicalName

Use this as first parameter in IOrganizationService.Retrieve method. Using Entity.EntityLogicalName avoids any typo error in entity logical name. 

IOrganizationService.Retrieve method returns single Entity record and can be casted to respective strongly type class to have intellisense in Visual Studio.

(Account)_service.Retrieve(Account.EntityLogicalName, _accountId, new ColumnSet(true));

Following example demonstrates how to retrieve a account record in Microsoft Dynamics CRM using Early Bound

C#

using Microsoft.Xrm.Client.Services;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;

namespace Msxrmtools
{
class Program
{
static void Main(string[] args)
{
//"connection" = connection string name from config file"
IOrganizationService _service = new OrganizationService("connection");

//assumed guid of existing account record
Guid _accountId = new Guid("9ec0b0ec-d6c3-4b8d-bd75-435723b49f84");

Account account = (Account)_service.Retrieve(Account.EntityLogicalName, _accountId, new ColumnSet(true));

Console.Write(account.Name);
Console.Write(account.Revenue);
}
}
}

What is the difference plugin and workflow?

  1. Plugin is not intend to fire or execute logic while timeout or subscription with recursive.
  2. Plugin supports all most every message other than creation, status change, and assignment, attribute change and deletion.
  3. Plug-inis not bound by the features and logic patterns that the workflow editor supports.
  4. Elevations on privilege which the process is execute on behalf of another user but in workflow users they can create their own.
  5. We can’t stop plugin process execution like work flow stops using stop workflow step.
  6. We can’t execute plugin process either manually or on demand.
  7. Only developers can implement the plugin.
  8. Plugin support both offline, online and on-premise which means sandbox.
  9. Immediate effect on result.
  10. Needs a synchronous action to happen before or after an event occur.
  11. Can be triggering either child pipeline or parent pipeline.

[Job] - TCS: MS Dynamic CRM Functional Consultant, India

Company: Tata Consultancy Services

Location: Kolkata, India

 

  

 

BACHELOR OF COMPUTER APPLICATION, BACHELOR OF COMPUTER SCIENCE, BACHELOR OF ENGINEERING
Enterprise Solutions and Frameworks - Microsoft Dynamics CRM
Candidate should be a MS Dynamics CRM Functional Consultant, with good knowledge on Dynamics CRM entities , workflows , configurations , customization development , integrations development; Sound in core NET technology and SSRS; Proficient on CRM Functional areas in Sales Force Automation , Marketing automation and Service management functionality

Product Catalog : Product Kit

  • Products can also be bundled together to form a kit.
  • A kit helps to simplify the sales and ordering process.
    • For example, if an organization sells digital cameras and batteries, these two products can be bundled together to form a kit.
  • To form a kit, first convert the product to a kit product, and then add each product to the kit.

What's New in CRM 2011: Dynamic Marketing Lists

CRM 2011 - a how-to video on creating and managing dynamic marketing lists in the marketing module of CRM.

Organization Data (OData) Service in Microsoft Dynamics CRM

Organization Data service is available since Microsoft Dynamics CRM 2011 and is mainly used for client side development (code running in browser)  using JavaScript. 

It supports JSON format for request and response which can be easily handled from JavaScript, therefore this is preferred service for client side development.  

Key points about Organization Data service:

  • It is preferred service for client-side development.
  • Organization Data service is also known as "OData" or "REST" endpoint.
  • Microsoft Dynamics CRM uses Windows Communication Foundation (WCF) to provide REST-based service.
  • It supports JSON and ATOM format.
  • Organization Data service can be used within Web resources, form scripts and ribbon commands.
  • Authentication is provided by the application itself, no need to write authentication code.
  • It implements OData v2 standard.
  • It is deprecated with Microsoft Dynamics CRM 2016, Web API should be used to support Microsoft Dynamics CRM 2016 and future versions.
  • It can return maximum 50 records in a single retrieve operation.
  • It is much fatser as comared to Organization service, because less bytes in JSON message in comparison to SOAP message.

Actions that can be performed with Organization Data service:

  • Create   
  • Retrieve
  • Update
  • Delete
  • Associate
  • Disassociate 

Organization Data service usage:

  • Improves use experience, avoids unnecessary page refresh. 
  • CRUD operation from JavaScript.
  • Validation at client side.
  • Conditionally populating fields from organization data.

Organization Data service endpoint URLs

Organization Data service endpoint URL for Microsoft Dynamics CRM organization can be found at:

 Settings > Customizations > Developer Resources

http[s]://ServerName/OrganizationName/XRMServices/2011/OrganizationData.svc 

Dynamics CRM 2011 Workflows, Queue Items and E-Mail Marketing

This video shows how to use CRM 2011 workflows to automatically route CoreMotives e-mail responses to queues.

IFD for Microsoft Dynamics CRM 2011

This video covers the end-to-end process for configuring IFD which includes:

  1. Installing AD FS 2.0
  2. 2. Configuring the AD FS 2.0 federation server
  3. 3. Managing certificates
  4. 4. Configuring Dynamics CRM 2011 for claims-based authentication and IFD
  5. 5. Creating the relying party trust for CRM and configuring the claims rules on AD FS 2.0

You can find a white paper covering this information here:

Microsoft TechNet: http://go.microsoft.com/fwlink/?LinkID=212715

Microsoft Download Center: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3621

Microsoft Dynamics CRM Sales Process Management

Watch this 7 minute video demonstration to learn how Microsoft Dynamics CRM can streamline, drive and control the complete sales cycle of your business. Contact one of our experts for more information. W: www.pa.com.au E: microsoftinfo@pa.com.au T: 1800 126 499