Advertisements

Archive

Archive for January 26, 2017

New field ‘Sort Date’ in Activity Pointer entity – Dynamics 365

January 26, 2017 Leave a comment

A new field ‘Sort Date’ (Schema Name – sortdate) has been added to the ‘Activity Pointer’ entity to control the sorting of the Activities.

sort-date-activities

Limitation with earlier CRM versions:

  • To display a list of activities and order them by date, we can only use the common date attributes like ‘Created on’ or ‘Modified on’ defined in the activitypointer entity.
  • What if you have to sort Email activities by ‘Sent On’ attribute rather than the modifiedon attribute value?

How ‘Sort Date’ Solves This:

  • With ‘Sort Date’ attribute, we can control how activities are sorted by desired date.
  • By default, the ‘Sort Date’ attribute value is null.
  • Set the ‘Sort date’ attribute value using a workflow or a plugin with required Date value (For example, set ‘Sort Date’ with ‘Sent On’ value in case of Emails) and use that in views.

🙂

Advertisements

Create a child record by copying mapping fields data from Parent – Using CRM SDK

January 26, 2017 Leave a comment

Let’s take the OOB Account and Contact related entities.

Whenever we click ‘Add New Contact’ button from the ‘Associated view’ of ‘Account’ form, all the mapping fields data would be copied to ‘New Contact’ form.

Account:

account-form

New Contact Form:

create-contact

This is native CRM behavior, to copy the content from Parent to Child record, using the Relationship ‘Mappings’ to avoid the overhead of manual data entry on child record.

account-and-contact-mappings

What If we have to create a Contact from a console application using CRM SDK and achieve the same behavior?  ‘InitializeFromRequest’ is the answer.

Steps to use ‘InitializeFromRequest’:

  • Instantiate the ‘InitializeFromRequest’
  • Set the Target as ‘Contact’
  • Set the ‘EntityMoniker’ as the reference of parent ‘Account’ which you would want to copy the data from
  • Execute the ‘InitializeFromRequest’
  • From the ‘InitializeFromResponse’, read the Contact object with copied data from Account (**Contact would not be created in CRM at this point**)
  • Fill the other attributes
  • Create the Contact

Source Code:

InitializeFromRequest initialize = new InitializeFromRequest();

// Set the target entity (i.e.,Contact)
initialize.TargetEntityName = “contact”;

// Create the EntityMoniker of Source (i.e.,Account)
initialize.EntityMoniker = new EntityReference(“account”, new Guid(“D4CBEE74-B5E3-E611-8109-C4346BDD8041”));

// Execute the request
InitializeFromResponse initialized = (InitializeFromResponse)orgService.Execute(initialize);

// Read Intitialized entity (i.e.,Contact with copied attributes from Account)
if (initialized.Entity != null)
{
// Get entContact from the response
Entity entContact = initialized.Entity;

// Set the additional attributes of the Contact
entContact.Attributes.Add(“firstname”, “Rajeev”);
entContact.Attributes.Add(“lastname”, “Pentyala”);

// Create a new contact
orgService.Create(entContact);
}

If you put the debugger and watch the ‘initialized.Entity’ you would see the populated fields.

initialized-entity-contact

Post execution of this code, a new Contact would get created with copied data from Account.

contact-form

🙂

Access and Edit Web App files hosted in Azure

January 26, 2017 Leave a comment

I have an Asp.Net Web application hosted as a Web App in my Azure instance.

One of the requirement I frequently get is to view or edit the published ‘Web App’ files from Azure Portal.

azure-web-apps

As we cannot access the ‘Web App’ files from Azure portal, one of the simpler way to access the files is by using the Visual Studio ‘Server Explorer’.

  • From the Visual Studio, open the ‘Server Explorer’ window

visual-studio-server-explorer

  • Connect to the Azure Subscription
  • Select the Web App under ‘App Services’ node and access the files.

server-explorer-access-files

Pre-requisites:

  • You need to have Azure SDK 2.7 installed.
  • Visual studio 2013 or higher version.

🙂

Categories: Azure Tags: , ,