Quantcast
Channel: Sam's Activities
Viewing all 3363 articles
Browse latest View live

Microsoft Dynamics Marketing for Microsoft Dynamics CRMers

$
0
0

 

I have been working with Microsoft Dynamics CRM since CRM 3.0 and any new update in CRM does not really makes me nervous looks and feels being on familiar ground.

And here I was starting off with Microsoft Dynamics Marketing, something I was avoiding for quite some time now… reason simply being… not familiar with “Marketing”. There are some good courses on the Dynamics Learning Portal and should you have access to the site, you should try out the courses there as a good starting point to understanding MDM.

 

To begin with, when you login to MDM you find yourself with a menu that has what would appear to someone using MSDCRM as just too broad and too many areas to learn and understand. Well that was my first mental block looking at MDM… there is just so much to do… where do I start…

Well the hierarchy is

Programs -> Campaigns -> Events -> Jobs -> Tasks

Though it is not mandatory that you have all of these in your marketing process and you can skip the ones that you do not really require.

 

MDM Terms/Concept

MDM can be used for different purposes in each of the implementation. MDM design supports the following

  1. Company implementing MDM for its own organizations marketing activities.
  2. Company implementing MDM to manage the marketing activities of its own branches, these could be     multiple divisions or even separate companies
  3. An advertising firm using MDM to manage the marketing activities of its customers

Site Company

This is the company that you set in the Settings Area. This is the base organization that is using MDM. It could be any of the above.

Companies

These are the equivalent of Accounts in CRM. You would store the organization information in here. If you had branches for which you wanted to manage the marketing activities you would create them as Company in MDM. It would be Client Company.

Company can be categorized as Client and/or Vendor. A third category available is Marketing.

Note: Categorization is very important in MDM. Depending on the category chosen you would see these companies under “Client Companies” listing or “Vendor Companies” listing. Marketing Companies are companies that have been received as part of a marketing database. When you integrate MDM with CRM using the MDM connector, the Accounts and Contacts from CRM are brought in categorized as Marketing in MDM and appear under Marketing Companies and Contacts listing.

Contacts

Contacts in MDM is any person. Users of MDM are also Contacts. Contacts can be categorized as “Client, “Vendor”, “Staff” or “Marketing”.

MDM UI Navigation

The menu structure is pull-down menus something that MSDCRM inspired from. It might help getting around with MDM if you knew a few of the following. Coming from Dynamics CRM, I was looking for common actions that I performed in CRM and how do I get around that here

1.      Where are Views?

There are no Views in MDM that you can quickly access as in CRM. You have the option of search and filtering records though.

 You can filter directly within the columns in the grid. A button to toggle between My/All and Active/All records.

 You can also drag columns that you want to group by and have the grid group the data based on that column

 

2.      Where is the lookup button?

 There is no explicit lookup button to select the record from a related entity. Now this is something I had a hard time to figure out. Perhaps it is our connection speed. There is supposed to be auto-drop-down that shows up as you start typing. In my case that never showed up. Now it is very important that the list show up and you select a record from the list coz otherwise when you tab out anything you have typed is cleared out, even if you had typed in the correct name of the related record L

A way to explicitly have the drop-down list show up is by typing %% in the text box and then hit spacebar

 

 

3.      Where are my sub-grids?

 Instead of adding multiple sub-grids on the form. They have instead added a single “Entity Selector” that lists all the related entities. Select the one you want to work on, and the data for that entity would be listed in the grid along with appropriate buttons on the ribbon bar.

 

4.      Can I customize?

 No.

 You cannot change the layout of the form or re-arrange the fields on the form. No, you cannot add custom fields. The product ships with User Defined Fields already added to most entities. You can rename the label and start using this fields for your own purpose. Again these are a limited count for each data type and you need to make do with them

 

5.      How do I find the User Defined Fields to repurpose?

 Good question J First look across the menus, you wouldn’t find anything familiar that you would seem related to custom fields J Alteast I didn’t. Found it in the initially unseemingly menu option Settings à Languages.

 

This is where you are allowed to change the labels and messages. And since adding custom fields is nothing but changing their labels, this is where you do it.

 

The language will list out all labels for all entities. An easy way to filter out labels of User defined fields, we can search for user

 

The above screen lists out the 10 custom fields available for Company.

 Change the Site Label of the UDF to indicate to the system that you are using it as a custom field. The moment you change the label to be different from the default label, this field will now be available on the form.

 In the above screenshot we have changed User 4 (text) and User 5 (Category).

 

6.      Where is my custom field on the form?

 Custom fields are not placed on the default top section of the form. You will find custom fields added to the Details tab. You can find the Details tab in the Tab/View/Entity selector for the record.

 

7.      How do I add options to my custom picklist field?

 That is done in Categories. The values for picklist options are maintained as Categories in MDM. All picklist fields throughout MDM can be found here.

Settings -> Categories

 

 

Choose your field and add options there

 

 

And now back to the Company form, you see these options there

 

8.      How do I manage Workflows/Process flows?

There is a visual designer provided to point-click-drag and design your entire process flow.

 

 

No code required :)

 

 

These were some on the questions that I was exploring and I thought some of these could be common to others as well and this should help them familiarize themselves with Microsoft Dynamics Marketing.

I would continue to post here as I move along in my journey to understand and master Microsoft Dynamics Marketing.

 


Create or Update through a single request – Upsert in Dynamics CRM 2015 Update 1

$
0
0

Background:

Traditionally, insert and update have always been separate requests in Dynamics CRM. The logic to identify whether a record has to be created or updated was always something the developers had to handle themselves. Once you have identified the action to perform, call the appropriate message.

The API enhancements introduced in Dynamics CRM 2015 Update 1 (Spring Update CRM Online), we have now been provided with a new Request/Message “UPSERT”. Note this message is currently not available for On-Premise systems and it requires the CRM Online organizations to be updated to 7.1.x.

 

How does UPSERT work?

For UPSERT to work, we need to use the concept of Alternate Keys that is also a new concept introduced in the Spring Update. To learn more about Alternate Keys you can check the article here. In the AlternateKeys, you provide the fields/value pairs to look for a matching record. You cannot use any combination of field/value pairs. The field/Value pair provided should be a part of an Altenate Key already defined for the entity.

Here is how we form the request

// Define the Alternate key which uniquely identifies the record
KeyAttributeCollection acckeys = new KeyAttributeCollection();
acckeys.Add(“accountnumber”, “ASH001″);

// Create Account entity object by specifying the entity logical name and Alternate key
Entity accountEntity = new Entity(“account”,acckeys);

// Specify fields to update
accountEntity["name"] = “Account 001″;
accountEntity["telephone1"] = “23457567”;

// Create Upsert request
UpsertRequest upreq = new UpsertRequest();
upreq.Target = accountEntity;

// Execute Upsert request
UpsertResponse response = (UpsertResponse)_service.Execute(upreq);

 

Working: 

You first define the Alternate Key that is to be used as the match criteria. Make sure you pass this Key as a part of instantiating the entity object.

Next you go ahead and create an entity object just like you did previously.

When this request is executed, the API looks for the match based on the Keys provided. If a match is found, it internally send an Update request. The Update Plugins/Workflows if any registered would be executed.

If no matching record is found, it will internally call the Create request. The Keys are passed on as a part of the entity fields and the record created would also have the values automatically set for these fields. So in the above example, we have not explicity added AccountNumber to the Entity attribute collection. But since it has been provided as part of Alternate Keys collection, the newly created record would have the accountnumber set to “ASH001″. In this case, the Create plugins/workflows would be executed.

 

How to identify if it actually Inserted or Updated the record?

The UpsertResponse, provides you with the details on this. In the “UpsertResponse” we get the “RecordCreated” attribute set to “True” if the Create request was called and a new record was created. It is set to “False” if the record existed and was updated. 

One thing which you can notice in the above Upsert operation is that there was no need to provide the Id field (GUID which uniquely identifies any record in Microsoft Dynamic CRM) i.e. “accountid” in case of Account entity for identifying the existing matching record and then perform Create or Update operation. We achieved this using the alternate key which uniquely identified if the record existed and thereby eliminated the overhead of retrieving existing record to check if the record already exists.

 

Conclusion: 

Upsert helps reduce the roundtrips required for explicit search requests that was otherwise used. This could be widely used in scenarios where data needs to be integrated with external systems and ID/GUID is very rarely the match criteria. Make sure to define the Keys before you use them as part of this request.

API enhancement – Service.Update Message in CRM 2015 Update 1

$
0
0

Introduction:

For updating an existing record in Dynamics CRM, we have always had the Service.Update message. Pass in the entity object and it would update the corresponding record back in CRM. This message however only allowed you to update regular fields. CRM has always had some special fields like Status, Owner etc that could not be updated using the Update Message. These had special messages in the SDK to update the values.

To update Owner, use Assign request

To update Status, use the SetState request.

In this current release, the API has been update, to remove the need to execute special messages for Status and Owner and instead we can now update these by setting these fields and passing them as a part of the Update request to CRM.

Code Sample differences:

Updating the rating, the Owner and the status of the contact record in Dynamics CRM

Entity contact = new Entity(); 

//specify the entity logical name
contact.LogicalName = “contact”; 

//specify the contact that need to be updated
contact.Id = new Guid(“A925C42D-CFE4-E411-80E8-C4346BAD5414″); 

//Set the fax field
contact["fax"] = “412”; 

//Call the update message
service.Update(contact);

//Call the Assign to change the owner
AssignRequest assign = new AssignRequest
{
Assignee = new EntityReference(SystemUser.EntityLogicalName, _otherUserId),

Target = new EntityReference(Contact.EntityLogicalName,new Guid(“A925C42D-CFE4-E411-80E8-C4346BAD5414″))
};

// Execute the Request
_service.Execute(assign);

//Now change the status

// Create the Request Object
SetStateRequest state = new SetStateRequest();

EntityReference contactReference = new EntityReference()
{
LogicalName = Contact.EntityLogicalName,

Id = new Guid(“A925C42D-CFE4-E411-80E8-C4346BAD5414″)
};

state.EntityMoniker = contactReference

// Set the Request Object’s Properties
state.State = new OptionSetValue(1);
state.Status = new OptionSetValue(2);
 

// Execute the Request
_service.Execute(state);


 As you can see, it took 3 separate request to get these 3 fields updated.

With the new API you can simply perform all of these three with a single Update request

Entity contact = new Entity(); 

//specify the entity logical name
contact.LogicalName = “contact”; 

//specify the contact that need to be updated
contact.Id = new Guid(“A925C42D-CFE4-E411-80E8-C4346BAD5414″); 

//set the fax
contact["fax"] = “412”;

//change the owner of the contact
contact["ownerid"] = new EntityReference(“systemuser”, new Guid(“FB8C44BF-B0E9-E411-80ED-C4346BAD5414″)); 

//change the status to inactive
contact["statecode"] = new OptionSetValue(1); 

//change the state to inactive
contact["statuscode"] = new OptionSetValue(2); 

//update the contact
service.Update(contact);

 Impact on Plugins:

The SetState and Assign request have always called the Update request also internally. This means, if you had a plugin registered on SetState, Assign and Update message of the “Contact” entity. The sample code above would have executed the SetState and Update, both plugins for just the SetState request. Similarly the Assign would have executed the plugin registered on both Assign as well as Update message. So it was the Update message that was executed irrespective of which fields or through which message a record was updated in Dynamics CRM.

The new API Update message, will not internally execute the SetState or Assign request if you were to execute the above sample code to update the owner and the status. So any previous plugins registered on the SetState or the Assign request will be have to re-registered on the Update message, should you plan to start using the new Update message to update the owner and status as well.

When you change the owner or the state of the record from CRM UI, it still executes the SetState and Assign Plugin, so it does not impact there.

The new API would not execute the SetState or Assign message plugin, BUT, it will call an UPDATE request for each of these messages i.e the sample code above would result in the UPDATE plugin being executed thrice.

1st time for the updating Fax – This time, the target would receive only the Fax field (non-owner/non-status fields)

2nd time for the Owner – only the owner field is available in Target

3rd time for the state – This time only status fields are passed in Target.

The following sample plugin code, would help you understand how to identify for which field the plugin has been triggered.

// Check if plugin context contains the Target

if (context.InputParameters.ContainsKey(“Target”))
{
Entity targetContactEntity = (Entity)context.InputParameters["Target"];

string desc = “”;

if (targetContactEntity!= null)
{
// When fired for owner change
if (targetContactEntity.Attributes.ContainsKey(“ownerid”))
{
desc = “Owner changed”;
}

// When fired for status change

if (targetContactEntity.Attributes.ContainsKey(“statecode”))
{
desc = “Status Changed”;
}

// Create Task activity

Entity task = new Entity(“task”);

task["subject"] = “Task from plugin : ” + desc;

_service.Create(task);
}
} 
  1. Once for all non -owner / non-status fields i.e. “fax” – When fired for rest of these fields the target entity attribute does not contain “owner” and “statecode”. Hence the “Task” which we are creating in this plug-in is created with subject – “Task from plug-in”.
  2. Once for owner field change – When fired for owner field the target entity attribute will only contain updated owner field. So here we can find out if the plug-in has been fired for owner field change by checking for if the target entity attribute contains “ownerid” as done in above plug-in code. Hence the “Task” is created with subject – “Task from plug-in : Owner changed”.
  3. Once for Status field change – When fired for status field the target entity attribute will only contain updated status field. So here we can find out if the plug-in has been fired for status field change by checking for if the target entity attribute contains “statecode” as done in above plug-in code. Hence the “Task” is created with subject – “Task from plug-in : Status changed”.

Impact on Workflow:

  1. Workflows registered for the Assign message by users continue to be triggered by updates to owner fields.
  2. Workflows containing the Change Status step continue to be triggered by updates to state/status fields.

For example:

If you have a workflow registered to execute when a record is assigned, updating the owner of the record using “Update” operation would trigger the workflow. Similarly for the Status changes workflow, they are triggered as well when the state is changed using the new Update message.

Conclusion:

  • Allows to change the Status, State, Owner, Business Unit and Manager using a single Update operation.
  • Reduces the code complexity.
  • Additional service calls to the CRM are reduced thereby improving performance.

Change Tracking Feature of CRM 2015 Update 1

$
0
0

As we have integration of Dynamics CRM with other external systems, in that case we need to keep track of changes that were done after last synchronization of data and we integrate only those changes in external system. To achieve this previously we have to add some kind of custom logic like add one date field in CRM to track the date of last synchronization. Now, in CRM 2015 update 1 we have a built-in functionality to achieve this, it is called Change Tracking.

Change Tracking is used in Dynamics CRM to keep the data synchronized in a better way by detecting what data has changed since the data was last synchronized.

To retrieve the changes for an entity, we need to enable the Change Tracking functionality for that entity.

This feature can be enabled by using the customization user interface (UI) or programmatically by setting the ChangeTrackingEnabled property to True.

ChangeTracking2

To achieve this functionality CRM 2015 has introduced a new request called RetrieveEntityChangesRequest.

When you execute this request for the very first time, then it returns all records for the entity and that data can be used to sync into any other external system. The message also returns a DataToken that we can use in the RetrieveEntityChangesRequest, so that when we execute this request the next time then it returns data for those changes that occurred since last execution of request.

If you want to get the changed data(created/updated/deleted) of Account since last execution of request then RetrieveEntityChangesRequest message is used to retrieve the data. After executing this request it will return the BusinessEntityChangesCollection of new/updated and deleted records. The new/updated records can be retrieved from NewOrUpdatedItem and deleted item can be retrieved from RemovedOrDeletedItem.

Following is the sample code for RetrieveEntityChangesRequest:

RetrieveEntityChangesRequest changeTracking = new RetrieveEntityChangesRequest();
//set the properties
changeTracking.Columns = new ColumnSet(true);
changeTracking.DataVersion = “471550!05/15/2015 10:08:13″;
changeTracking.EntityName = “account”;

changeTracking.PageInfo = new PagingInfo() { Count = 5000, PageNumber = 1, ReturnTotalRecordCount = false };

RetrieveEntityChangesResponse res = (RetrieveEntityChangesResponse)_service.Execute(changeTracking);

//get the token
string dataToken = res.EntityChanges.DataToken;
BusinessEntityChangesCollection busEntChanColl = res.EntityChanges.Changes;

for (int bizColl = 0; busEntChanColl.Count > bizColl; bizColl++)
{
if (busEntChanColl[bizColl].Type.ToString().ToLowerInvariant() == “neworupdated”)
{
NewOrUpdatedItem createUp =(NewOrUpdatedItem) busEntChanColl[bizColl];
Entity changedEnt = createUp.NewOrUpdatedEntity;
}
else if(busEntChanColl[bizColl].Type.ToString().ToLowerInvariant() == “removeordeleted”)
{
RemovedOrDeletedItem removeOrDelItem = (RemovedOrDeletedItem)busEntChanColl[bizColl];
EntityReference delItem = removeOrDelItem.RemovedItem;
}
}

If you doesn`t provide the DataVersion parameter for request then it will always return all records.

So to retrieve only records those are Created/Updated/Delete after the last execution of request then you have to provide the DataVersion parameter, DataToken returned by previous execution of request is what we have to pass as DataVersion new value for the next request.

For example: res.EntityChanges.DataToken in the above code snippet gives us the DataToken.

If you have the windows service/ windows application for integration of CRM with another system then you can store the DataToken value in app.config. If you used it in a plug-in or a workflow then it is better to create custom entity to store value of DataToken.

Dynamics CRM 2015 Online Update 1 – API support for Transaction

$
0
0

Introduction:

As a developer, you always want to perform any database operation in a Transaction so that you have the choice of rollback in case an operation fails. There are many examples where you want either all of your API instructions to succeed or all of them to rollback. If there is only a partial successful execution, it could lead the database in an unstable state. This is especially true of scenarios where you would like to create one record with multiple other related records. You want the master record created only if all other related records could be successfully created as well. If any related operation fails, do not create the master record as well.

Unfortunately, until this update, Dynamics CRM did not support transaction for actions performed through the API by the developers.

ExecuteTransactionRequest:

This is a new request that is introduced with the Dynamics CRM Online Update 1 (7.1.x).  With this request you need to provide a collection of Organization request like Create, Update, Delete, SetState, Assign, any organization request and have CRM execute them in a transaction. This means any of the request in the collection fails, all the other requests would also rollback. The response of this request would also be a collection of responses corresponding to every request that was included in the request collection.

ExecuteTransactionRequest execTrans = new ExecuteTransactionRequest()

{

ReturnResponses = true,

Requests = new OrganizationRequestCollection()

};

Below is an example of how could you add different organization requests in the request collection. Note, we are adding different messages for the sake of clarity about this message.

///// Create Account Request//////

Entity account = new Entity(“account”);

account["name"] = “Transaction request 1″;

CreateRequest createAcc = new CreateRequest();

createAcc.Target = account;

//add create request in a request collection

execTrans.Requests.Add(createAcc);

////// Update request ///////

Entity contact1 = new Entity(“contact”);

contact1["firstname"] = “Samantha”;

contact1["lastname"] = “Ray”;

contact1[“emailaddress1”] = “sammy@example.com”;

//set gender value

contact1[“gendercode”] = new OptionSetValue(3);

//Update request to update a contact

UpdateRequest upReq = new UpdateRequest();

upReq.Target = contact1;

upReq.Target.Id = new Guid(“58C7D2CB-7A0E-E511-80DC-FC15B4289E14″);

//add update request in a collection

execTrans.Requests.Add(upReq);

///// Status Change Request //////

SetStateRequest state = new SetStateRequest();

//set the reference of target entity

state.EntityMoniker = new EntityReference(“contact”, new Guid(“A925C42D-CFE4-E411-80E8-C4346BAD5414″));

//set the state of the record to inactive

state.State = new OptionSetValue(1);

state.Status = new OptionSetValue(2);

//add set state request in collection

execTrans.Requests.Add(state);

///// Delete request //////

DeleteRequest delete = new DeleteRequest();

//provide target entity reference which needs to be deleted

delete.Target = new EntityReference(“account”, new Guid(“4125C42D-CFE4-E411-80E8-C4346BAD5414″));

//add delete request in collection

execTrans.Requests.Add(delete);

Finally execute the ExcecuteTransaction Request

//Execute the request

ExecuteTransactionResponse response = (ExecuteTransactionResponse)_service.Execute(execTrans);

The response of this can be read as shown below

response.Responses would contain the collection of the responses returned for each of the request submitted to the request above.

You can read the response for each of the individual request by matching the index in the request collection with that in the response collection.

img

For the create request, the response would provide the id in the response.

OrganizationResponse resp = response.Responses[0]

Since this was a createRequest, the response would be the CreateResponse that is returned. You can find the Guid of the newly created record

id = (Guid)orgResponse.Results["id"];

If an error occurs in executing any of the message in the collection, it would throw a fault exception of the type ExecuteTransactionFault which will return the index of a request collection of the request message that caused the fault.

Here is how it looks in the debugger

img2

You can read it using the following code.

catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> ex)

{

ExecuteTransactionFault fault = (ExecuteTransactionFault)ex.Detail;

int faultedIndex = fault.FaultedRequestIndex;

}

Conclusion:

Do not confuse this with ExecuteMultiple that was introduced in one of the earlier updates to Dynamics CRM. Some points to remember

  • ExecuteMultiple allowed you to process multiple messages in a single batch to reduce the roundtrips required to process multiple messages.
  • ExecuteTransaction goes a step further to ensure that all of the messages submitted to it are executed in Transaction mode. Rollback if any message fails.
  • You can include an ExecuteMultiple request within an ExecuteTransaction request.
  • The max messages that can be executed in a batch is 1000

Hope it helps!

Need more help, Email us on: crm@inogic.com. You can also visit us on: www.inogic.com 

Keywords : Dynamics CRM, Microsoft Dynamics CRM, Dynamics CRM 2015, Dynamics CRM 2015 Update 1

Retrieve and Instantiate Global Email Template

$
0
0

Have you ever Retrieved or Instantiated an email template? If the answer to this question is YES, then you might be knowing the required parameters we need to have in place in order to do so.

For those of who aren`t aware of it then this blog would help you understand the tidbits involved.

We had a request in which we were supposed to use a Global Email Template for sending emails.

Well we had done the same for entity specific email template, but this was something we had never done until the request.

Let`s get started with the explanation of how we achieved it.

First, we`ll retrieve a Global Email template.

Retrieve:

Here we`ll retrieve the Global Email Template, on the basis of the Template Name. We just need the GUID for this demo, so we would just be retrieving the GUID of the template. The retrieved GUID would then be used to Instantiate the template.

Code Snippet

public void RetrieveTemplate()

        {

            string functionName = "RetrieveTemplate";

            Guid templateId = Guid.Empty;

            try

            {

                string emailTemplate = "Welcome Email";

                FilterExpression filter = new FilterExpression();

                ConditionExpression conditionTitle = new ConditionExpression();

                ConditionExpression conditionType = new ConditionExpression();

                QueryExpression query = new QueryExpression();

                //title

                conditionTitle.AttributeName = "title";

                conditionTitle.Operator = ConditionOperator.Equal;

                conditionTitle.Values.Add(emailTemplate);

                //entity type               

                conditionType.AttributeName = "templatetypecode";

                conditionType.Operator = ConditionOperator.Equal;

                conditionType.Values.Add("systemuser");

                //add conditions

                filter.FilterOperator = LogicalOperator.And;

                filter.Conditions.Add(conditionTitle);

                filter.Conditions.Add(conditionType);

                query.Criteria = filter;

                query.ColumnSet = new ColumnSet();

                query.EntityName = "template";

                query.ColumnSet.Columns.Add("templateid");

                EntityCollection templateCollection = _service.RetrieveMultiple(query);

                if (templateCollection.Entities.Count > 0)

                {

                    templateId = templateCollection[0].Id;

                    InstantiateTemplate(templateId);

                }

             }

            catch (FaultException<OrganizationServiceFault> ex)

            {

                throw new FaultException(functionName + ":" + ex.Message);

            }

            catch (Exception ex)

            {

                throw new Exception(functionName + ":" + ex.Message);

            }

        }

 Explanation

  • Entire code is similar to what it should have been for retrieving Entity Specific Email template; the difference here is the part where we specify "templatetypecode”.
  • If the template is an entity specific template, then we would have used the respective entity`s logical name, but in this case we are retrieving a Global Email Template, then what could be "templatetypecode"? Here is a trick; we need to use "systemuser" as the "templatetypecode".  And this simple it is to retrieve Global Email Template.
  • Using the above code, we`ll get the GUID of the global template and that GUID will then be used in instantiating the Global Email Template.

Instantiate:

Here on the basis of the retrieved GUID, we`ll instantiate the Global Email Template, and that would be the last step of this procedure.

Code Snippet

private void InstantiateTemplate(Guid templateId)

        {

            string functionName = "InstantiateTemplate";

            EntityCollection templateCollection = new EntityCollection();

            Entity template = new Entity();

            try

            {

                InstantiateTemplateRequest request = new InstantiateTemplateRequest();

                request.RequestName = "InstantiateTemplate";

                //Set Email template Id

                request["TemplateId"] = templateId;

                //Set Regarding

                request["ObjectId"] = userId;

                //Set regarding type

                request["ObjectType"] = "systemuser";

                //execute message

                InstantiateTemplateResponse response = (InstantiateTemplateResponse)_service.Execute(request);

                //Store response in collection

                templateCollection = (EntityCollection)response["EntityCollection"];

                if (templateCollection.Entities.Count > 0)

                {

                    template = templateCollection[0];

                }

             }

            catch (FaultException<OrganizationServiceFault> ex)

            {

                throw new FaultException(functionName + ":" + ex.Message);

            }

            catch (Exception ex)

            {

                throw new Exception(functionName + ":" + ex.Message);

            }

        }

Explanation

  • In the above snippet there are 3 key things to look at.
    • Template Id: It is the GUID of the template that we retrieved in starting.
    • Object Id: It is the GUID of the user from the organization. If this would have been an Entity Specific template then we would have used the GUID of any of the record from that entity.
    • Object Type: It is the systemuser in this case, since we are instantiating a Global Email Template. If it would have been an Entity Specific template then we would have used that respective entity`s logical name.
  • The noticing part was the above 3 points, rest is just executing the InstantiateTemplateRequest  and getting the response in InstantiateTemplateResponse which is further used to get the Entity from it.

Hope this helps!

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Retrieve and Instantiate Global Email Template appeared first on Inogic Blog.

Handling Date/Time fields in Microsoft Dynamics CRM 2015 Online Update 1

$
0
0

Introduction

Managing Date/Time fields in Dynamics CRM has not been easy especially when time zone come into picture and yet it is very critical to the application. Dynamics CRM being a global application was designed to support multiple timezones and the architecture design had a very noble thought behind it –

“No matter which timezone a user logs in and looks at a date/time value, the date/time should always be reflected in their own timezone”

To go ahead and support scenarios where on Date was required and not the time, they even created a format type to specify “Date-only” field.

To support this design architecture, the date time fields in the database are always stored in UTC format. The idea being the date/time could be then converted and shown in the time zone of the logged-in or the requesting user. You specify the timezone for each user in the User Options accessible through Options

Issues with storing in UTC

We sometimes only want CRM to store date as is, not really do the time conversion, no matter which time zone it is seen from, it should still display this static date as is. The date only field did not really achieve this. The date only is also stored as date with the time components as 12 am. Since it is UTC when viewed from another timezone, it would either go one day forward or a day back depending on the part of the world you are in.

Since it is stored in UTC any programmatic access to a date field would return a UTC value, which was not was really required and it required developers to add in date/time conversion code to use the date/time value retrieved from CRM.

New Enhancements

The product team has received well all the feedback sent around the issues with Date/time field type and with the Update 1 Online release, have brought about the following platform enhancements with the objective to resolve all issues around date/time fields.

They have now introduced a new setting called “Behavior” for date/time fields in Dynamic CRM 2015 Update 1, we are able to set DateTime field with different time behaviors.

Following are the behaviors:

  • User Local
  • Date Only
  • Time-Zone Independent

User Local:

When the DateTime behavior is set as User Local and format is Date and Time then the time displayed will be as per the user time zone. For example please find the screen shots below.

Here for “Interview date” field we have set the date and time behavior as “User Local”. So when this field will be set it will be seen as per the user time zone settings as follows –

 

In the above two screen shots you can find that the Interview Date field displays different time for both users as they both are from different time zones. This emulates the behaviour of all date/time fields in Dynamics CRM prior to these new enhancements. All existing date/time fields in CRM are set as User Local by default. You will need to go and manually edit the behaviour of the field if you would like it to behave as any of the following two behaviour types.

Programmatically when you retrieve this value from CRM say for example as an input parameter of a workflow, the DateTime.Kind attribute is set to UTC.

Date Only:

For date only field since only date is displayed it has no effect of the user time zone. This is a true date only field. There is no time conversion done to show this value on CRM form. It is stored just as is entered and returned when requested.

Programmatically when you retrieve this value from CRM say for example as an input parameter of a workflow, the DateTime.Kind attribute is set to none.

Time-Zone Independent:

This DateTime field will be set irrespective of the time zone of user. So in below screen shot you can find that the values for “Relieving Date” field which is of Time-Zone independent behavior shows same date time for both users although they lie in different time zones.

Programmatically when you retrieve this value from CRM say for example as an input parameter of a workflow, the DateTime.Kind attribute is set to none.

Conclusion:

With these enhancements it would be a little easier to manage the dates and avoid unnecessary conversions to get it to work.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Handling Date/Time fields in Microsoft Dynamics CRM 2015 Online Update 1 appeared first on Inogic Blog.

Keywords: Microsoft Dynamics CRM, CRM 2015, Date/Time Field, Dynamics CRM Update 1

Custom Actions in Dynamics CRM 2015 Online Update 1

$
0
0

Recap:

Back in 2013, when Microsoft introduced the concept of “Custom Actions”, we had explained this feature in this blog. With the latest update released for CRM Online versioned 7.1, this feature has further been extended.

As a quick recap, Actions in processes are a way to create custom messages in CRM for an entity, for example escalate or approve. OOB for most entities you have Create, Update, Delete, Assign, SetState messages and you have the option of writing custom business logic in the form of Plugins or Workflows on these.

You could invoke these custom action messages through Script or through C# code.

Example:

Say to implement a business process in one of the implementation, there was a need to create a message called “Escalate” for incident. Prior to the introduction of “Actions”, these were handled by adding a custom attribute and writing plugin/workflow code that tracked the change in the attribute value to execute custom logic.

For a true XRM implementation, a need was felt to be able define custom actions instead of use workarounds like the one explained above.

Here is a custom action “Escalation” that has been created.

The actual operations that need to be performed when this action is invoked is defined through the options available similar as in workflow designer.

Until now, we needed to add a custom ribbon button and invoke this action through a script. i.e this could only be invoked through a manual process. Or if it required to be automated, then you need to write a custom workflow assembly that would programmatically invoke the action.

Workflows

With this version, now instead of creating a custom workflow assembly to invoke the action, we now have a new step available “Perform Action“.

Using the Set Properties, you can now set the input parameters that was defined for the Custom Action.

Dialogs

Similar to the workflows explained above, we now also have the “Perform Action” step available in Dialogs, so Custom Actions can now be invoked through Dialogs too.


Note: An action that is designed to accept EntityCollection will not show up in the “Perform Action” since these parameter values cannot be provided through the workflow designer.

Conclusion:

It is now possible to automate the execution of the custom actions through workflow.

Hope this Helps!

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Custom Actions in Dynamics CRM 2015 Online Update 1 appeared first on Inogic Blog.

Keywords : Microsoft Dynamics CRM, CRM Online, Custom action, CRM 2015


One Note Integration with Dynamics CRM 2015 Online Update 1

$
0
0

Introduction:

In today’s world there would be very few who perhaps still use notepad or like application for taking notes. Majority use application like OneNote or EverNote to manage their notes. These application allow recording of rich data like pictures, videos etc within the application for later consumption. Recording notes traditionally in CRM has been through the Notes tab, that allows you to record multiple notes, but it has to be text. It supports file attachments though.

In the latest CRM Online release, Dynamics CRM would now provide a seamless integration to OneNote, this means you can now from within CRM directly record notes into OneNote and easily access them from within CRM.

Enabling this feature

This feature is built upon the Sharepoint Integration framework and requires that you have Sharepoint Integration enabled for CRM. So the first step would be to enable Sharepoint Integration

Navigate to Settings >> Document Management.

In this example we will “Enable Server- Based SharePoint Integration” and enter the valid SharePoint Url to integrate CRM with SharePoint account. 

img1

Once we integrate SharePoint with CRM, the OneNote Integration option is listed in document management as shown below in the screenshot.

img2

Then enable the OneNote and it will open “OneNote Integration Settings” in which we will select the entities for which we want to turn on OneNote integration. It will only list those entities for which Sharepoint Integration had been enabled.

img3

Once the OneNote integration has been enabled, you now start seeing a new option at the entity level in the customization screen

img4

For any new entity that you want to enable OneNote integration, you need to make sure, you check the Document Management and OneNote Integration options on the entity level.

Next run the Document Management Wizard to have the libraries created in Sharepoint for these entities.

img5

Once you have the integration enabled, you would find a new option ONENOTE showing in the Social Pane on the form.

img6

Since Sharepoint Integration needs to be enabled for OneNote integration, if you click on the onenote tab you would see the following error if no sharepoint library was already created for this record.

img7

Once the library is created, clicking on the ONENOTE tab will automatically create a OneNote notebook for the record with the same name as the record name and an untitled page will show up in the notes as shown below

img8

When you navigate to the Documents pane in the CRM, you will see the following files created in Sharepoint

img9

Note: Do not delete the .onetoc2 file found in the Sharepoint library. That file is necessary for the integration to work.

You can click on the Untitledonenote file in the OneNote pane, to directly open the OneNote file in OneNote Online.

img10

Adding a new Section in the notebook will add a new listing in the ONENOTE tab of the form.

img11

img12

You can create multiple sections but they will all be stored in the same notebook. Multiple notebooks cannot be created for a single record in CRM.

Changing the OneNote page name and the file name that appears in the OneNote pane.

Untitled is not a very descriptive or friendly name to have for a file. But unfortunately, the default file/page that is created for one-note integration is called untitled. What we found that renaming the Untitled Notebook after opening it in OneNote Online did not change the file name.

Also notice in the above screenshot, the date/time in the untitled page is also not the current date/time.

To fix this

  1. Go ahead and delete the default Untitled Page and the Untitled Section that shows up
  2. Create a new Section clicking the “+” button on the section

Give the name you want to see in CRM. In our case we have considered “CRM Section using OneNote App” and saved. The new section would be created in ONENote as follows:

img13

This now also reflects the current date/time.

  1. When you come out of OneNote and navigate back to the OneNote tab in CRM you will see the updated name

img14

  1. Another way to rename the section name is to do it through the desktop version of OneNote.

Security Privileges that control OneNote Integration

No new settings or privileges have been introduced related to ONE NOTE. However since it is very closely tied to Sharepoint Integration, privileges that control Sharepoint Integration essentially control the OneNote integration as well.

Suppose a user has a role with No create , read and Write privilege for Document Location as shown below :

img15

If this user tries to create a ONENOTE clicking the Tab one note is not created or loaded and following error is displayed

img16

And finally, the user needs to have access to the Sharepoint Document Library in Sharepoint to be able to access the onenote file.

Conclusion

You can now access OneNote file from right within Dynamics CRM, without the need to manually upload or download the file to make updates.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post One Note Integration with Dynamics CRM 2015 Online Update 1 appeared first on Inogic Blog.

How to Open Quick Create form in Dynamics CRM 2015 Online Update 1

$
0
0

You might be aware of how to open CRM entity form using javascript function that was introduced in Dynamics CRM 2013 i.e. Xrm.Utility.openEntityForm()

If you are not then you can refer our blog about this feature here. We use openEntityForm function to open blank entity form or entity form with pre populated values.

In CRM 2013 there was new feature introduced called Quick Create Form, using quick create form user can quickly create new record by staying on the same page.

The quick create form opens as below,

form

And there was no function or an option to open such quick creates form programmatically.

Sometimes we may need to open Quick create form programmatically. Microsoft has introduced new function in Dynamics CRM 2015 Online Update 1 to open quick create form same as open entity form.

This blog will illustrate how to open Quick create form.

Now there is one function available under Xrm.Utitlity called ‘openQuickCreate’ that open entity open form as shown in above screen shot.

Syntax,

Xrm.Utility.openQuickCreate(entityLogicalName,createFromEntity,parameters).then(successCallback,errorCallback);

Here,

entityLogicalName: Accept string value. Pass logical name of entity for which we need to open quick create form,

createFromEntity: Accept a lookup object, Pass lookup object that will provide default values based on mapped attributes values.

parameters: Accept a object, pass extra querystring parameters. We can pass field values as a parameter to set field values on the quick create form.

successCallback: This is a function that will call when record is created. It returns a lookup object of created record.

errorCallback: This is a function that will be called when error occurred. It returns errorCode andmessage.

From all above parameter only entityLogicalName is required and others are optional.

Below is an example where we will open Quick Create form to create a new child account from account entity form with some pre populated values.

//lookup object of current account record

var parrentAccount = {

 entityType: “account”,

 id: Xrm.Page.data.entity.getId()

};

var parameters = { name: “Child account of ” + Xrm.Page.getAttribute(“name”).getValue(), address1_postalcode: Xrm.Page.getAttribute(“address1_postalcode”).getValue() };

Xrm.Utility.openQuickCreate(“account”, parrentAccount,parameters ).then(function (lookup) { successCallback(lookup); }, function (error) { errorCallback(error); });

function successCallback(lookup)

{

        window.console.log(“lookup: ” + lookup.savedEntityReference.id);

}

function errorCallback(e){

        window.console.log(“Error: ” + e.errorCode +” “+e.message);

}

Above code opens a quick create form with auto populating name and postal code from parent account.

form1

The successCallback() calls when you save the record.

Hope it helps!

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post How to Open Quick Create form in Dynamics CRM 2015 Online Update 1 appeared first on Inogic Blog.

Immersive Excel Experience with Dynamics CRM 2015 Online Update 1

$
0
0

Introduction:

Export to Excel has been a feature that has been in Dynamics CRM since its initial release. Though it did the job, there were some annoying pop-up’s and probably a few clicks that could well be avoided. With the Online Update 1, the Export to Excel experience is set to change for the better.

Excel File Format:

In the earlier versions of Dynamics CRM, when you exported the data to Excel and tried to open the Excel file, you were prompted with this dialog

e1

We have been used to clicking on Yes and proceed further with opening the excel file.

With the latest update in place, you will not receive these innocuous messages.

Editing Excel:

Export to Excel has always had the feature to export the data for reimport.

e2

 

When this option was selected, the excel file exported would add the hidden GUID column to the excel sheet and you could then edit and import this sheet back into CRM. However the process was a 3 step process

  1. Export for re-import.
  2. Edit in Excel.
  3. Import the new excel file saved in CSV format using Import Tool.

Enhanced process of Editing

To avoid the 3 step process, you now can simply edit the records in-place. In a way you now have an Editable Grid in CRM. You can convert any of the CRM Views into an Editable Grid for basic field data manipulation and batch editing of records.

You can access this feature “Open in Excel Online” under the Export to Excel button available on all grids.

e3

Once you click on it you are directed to Excel Online page as you can see below:

e4

You can use any Excel Formulas you want and even edit the records if you wish to use.

Suppose we change the Account Name to “Name Updated”.

e5

We can even add any new records by adding data in the next row and saving the excel back to CRM.

e6

The record would be created in CRM when we click “Save the changes back to CRM”.

e7

You can see the record is created in CRM as below:

As soon as we click the “SAVE CHANGES TO CRM” following dialog shows up

e8

We can check the status of importing process at “Settings/ Data Management/Imports”.

e9

We can monitor the Import Job status from the Import Job. It shows the Creates and Updates performed in CRM due to the import. In our case it shows “Create” and “Update” as follows:

e10

Once the import job successfully completes, you can see the updates reflected in CRM. The Failures if any can be monitored in the job as well.

Security:

In order to use this functionality the user must have “Export to Excel” privilege.

e11

It appears you do not need to have an active Excel Online subscription for this to work. This was tested on an Org that did not have any active Office subscription.

Conclusion:

Easy to use, bulk editing tool with the power of Excel is now in your hands with this feature.

Hope it helps!

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Immersive Excel Experience with Dynamics CRM 2015 Online Update 1 appeared first on Inogic Blog.

Keywords : Dynamics CRM, CRM 2015, Dynamics CRM 2015 online Update 1

Manage Entitlement terms behavior with Dynamics CRM Online Update 1

$
0
0

Introduction:

Entitlements were introduced in CRM 2013 Spring Release. These are an enhancement to the concept of Contracts that has been in Dynamics CRM since its initial release. You can read more about entitlements from one our earlier blogs found here.

You could define the entitlement terms that a customer is entitled to. The entitlements are used against Cases to manage whether a case registered is covered within an entitlement or is billable/chargeable.

Whenever we create a case for the customer and apply the entitlement, the entitlements terms gets decremented from the associated entitlement defined for the customer.

However there could be some scenarios where you don’t want the entitlement terms to be decremented. To handle this special case, a new feature of “Decrement Entitlements” is introduced in the latest Dynamics CRM Online Update 1 release.

Walk-through:

Let’s see how we can prevent the entitlement to be decremented terms using “Do not decrement entitlement terms” option on Case.

We create the below entitlement “Mobile Accessories”, with the following specifications,

Control_Entitlements

Next, create a new case with the origin as “Phone” and apply the available entitlement against this case.

Control_Entitlements1

By default when this case is resolved, the entitlement terms would decrease by 1 since one entitlement term has been used for this case.

But if in special case, you would not like the entitlement terms to be decremented, you can now use the option “Do not decrement entitlement terms” on the case entity.

A new field “Decrement Entitlement Terms” is added on the Case entity that indicates the entitlement terms to be decremented or not.

By default the “Decrement Entitlement Terms” is set to “Yes” which will cause to decrement       entitlement terms for that case. You need to use the “Do not Decrement Entitlements” menu option added in the ribbon to set this to No.

Control_Entitlements2

Control_Entitlements3

When you activate the option “Do not Decrement Entitlement Terms” then the “Decrement Entitlement Terms” will be set to “No”. This means the entitlement terms will not get decrement from the entitlement.

Once it is set to “No” upon resolving the case, the entitlement terms do not change.

Control_Entitlements6

Security:

Since this is a feature that should be utilized only in special scenarios, it has been introduced as a privilege “Control Decrement Terms” and only users with that privilege would be allowed to set the Decrement Entitlements flag on the Case entity.

You will find the new privilege added to the “Miscellaneous Privileges” section of the Service Management tab of the Security role.

Control_Entitlements7

By default, the Control Decrement Terms privilege is available to only System Administrator and CSR Manager Security Roles.

Hope it helps!

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Manage Entitlement terms behavior with Dynamics CRM Online Update 1 appeared first on Inogic Blog.

Dynamics CRM and Bing Maps integration using Maplytics – Add More Happy Customers

$
0
0

This is Part 1 of our series on some of the most common FAQ’s on our Maplytics solution which allows you to integrate your Dynamics CRM with Bing Maps for all entities.

maplytics

Why Maplytics?

First thing, Dynamics CRM does come with a Bing Map integration out of the box. Our solution takes this a step ahead, it allows you to integrate all entities including custom entities so you can explore more on customer statistics, know them better, serve them better and have more happy customers and obviously Grow your Business.

Do proximity search, color code your pushpins the way you want, have heat maps, export your results and much more.

Product Page – http://inogic.com/Product/76/Integrations/Maplytics
Video – https://www.youtube.com/watch?v=UgWslSIv5MM

Before we proceed, will it affect my existing customizations?
No, it is supplied as a managed solution that is easy to install and un-install without affecting your existing customization.

What versions does it support?
Maplytics supports all CRM deployment models namely on-premise, on-line, office 365 and partner-hosted. It supports Dynamics CRM 2011 and above.

Pricing?
Maplytics is available at 10USD per user per month. Special offers and volume discounting is also available. Don’t worry price is …..% (You can’t value how beneficial it would be for your business) of your business profit.

Can I grab a Trial?
Ofcoz, opt in for our 15 days fully functional trial. Email us on crm@inogic.com with your CRM version and deployment (on-prem or online) model.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Dynamics CRM and Bing Maps integration using Maplytics – Add More Happy Customers appeared first on Inogic Blog.

Keywords : Dynamics CRM, Bing maps, dynamics CRM and bing maps integration, Maplytics, Mapping tool for Dynamics CRM

Hierarchy Support in Dynamics CRM 2015 SDK

$
0
0

Introduction

Hierarchies were introduced in Dynamics CRM 2015.  Hierarchy provided a way for visualizing relation between records and identify where the records reside in parent child relationship.

As in example below shows where “Test Account02” situated in hierarchy tree.

Hierarchy_Support

SDK Support

To support the ability to retrieve records based on Hierarchy, the SDK was enhanced and new operators added that would allow you to specify the records to be selected in the hierarchy.

There are new conditional operators has been added in CRM SDK to utilize record hierarchy feature and retrieve records in hierarchy.

Listed below are the conditional operator can be used to retrieve records in hierarchy. We retrieved the records on account form load for account “Test Account02” and displayed in alert dialog to check the result. Below are the condition operator and its description.

1. above

Operator Scope: Can be used as conditional operator for the entity record.

Description: This retrieves records which are above the records in tree. In case of “Test Account02” it is “Test Account01” as below.

Hierarchy_Support1

Note : When records is retrieved with same operator for  account “Test Account05”.This will retrieve account “Test Acccount01” and “TestAccount02”.Accounts ”Test Account04” and  “Test Account03” are not part of the result.

2. eq-or-above

Operator Scope: Can be used as conditional operator for the entity record.

Description: This includes records above the specified record including record itself. In case of “Test Account 02” the result is as below.

Hierarchy_Support2

 3. under

Operator Scope: Can be used as conditional operator for the entity record.

Description: This operator used to retrieve records below the specified record in hierarchical tree. For “Test Account02” the result is as below.

Hierarchy_Support3

For the record “Test Account01” the result records are “Test Account02”,”Test Account03” ,”Test Account04” and ”Test Account05”.

 4. eq-or-under

Operator Scope: Can be used as conditional operator for the entity record.

Description: This operator is used to retrieve records below specified record in hieratical tree including the record. For “Test Account02” the result is as below.

Hierarchy_Support4

 5. not-under

Operator Scope: Can be used as conditional operator for the entity record.

Description: This operator used to retrieve records which are not below specified record. Result includes the current record too. This will be usable in combination with other operators. For “Test Account02” the result is as below. This includes all records except “Test Account05”.

Hierarchy_Support5

6. eq-owneduseroruserhierarchy

Operator Scope: Can be used as conditional operator for the owner field.

Description: This Operator used to retrieve records owned by user and also the records which are not owned by login user but part of hierarchy. We have created new account “test Account08” which is owned by another user. But its parent account is “Test Account03” as below.

Hierarchy_Support6

For “Test Account08” the result is as below.

Hierarchy_Support7

 7. eq-useroruserhierarchyandteams

Operator Scope: Can be used as conditional operator for the owner field.

Description: This Operator used to retrieve records owned by user and records owned by user in hierarchy.

Below is the screen shot shows Position “P1” and “P2” are related.

Hierarchy_Support8

Position “P1” contains first user and position “P2” contains user “John” as below.

Hierarchy_Support9

Hierarchy_Support10

Record “Test Account08” and “Test Account09” are owned By “Jon”. Since both users are related in hierarchy result for “Test Account03” will be as follows.

Hierarchy_Support11

“Test Account08” and “Test Account09” account records are included in the result.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Hierarchy Support in Dynamics CRM 2015 SDK appeared first on Inogic Blog.

Immersive Excel Experience with Dynamics CRM 2015 Online Update 1

$
0
0

Introduction:

Export to Excel has been a feature that has been in Dynamics CRM since its initial release. Though it did the job, there were some annoying pop-up’s and probably a few clicks that could well be avoided. With the Online Update 1, the Export to Excel experience is set to change for the better.

Excel File Format:

In the earlier versions of Dynamics CRM, when you exported the data to Excel and tried to open the Excel file, you were prompted with this dialog

e1

We have been used to clicking on Yes and proceed further with opening the excel file.

With the latest update in place, you will not receive these innocuous messages.

Editing Excel:

Export to Excel has always had the feature to export the data for reimport.

e2

 

When this option was selected, the excel file exported would add the hidden GUID column to the excel sheet and you could then edit and import this sheet back into CRM. However the process was a 3 step process

  1. Export for re-import.
  2. Edit in Excel.
  3. Import the new excel file saved in CSV format using Import Tool.

Enhanced process of Editing

To avoid the 3 step process, you now can simply edit the records in-place. In a way you now have an Editable Grid in CRM. You can convert any of the CRM Views into an Editable Grid for basic field data manipulation and batch editing of records.

You can access this feature “Open in Excel Online” under the Export to Excel button available on all grids.

e3

Once you click on it you are directed to Excel Online page as you can see below:

e4

You can use any Excel Formulas you want and even edit the records if you wish to use.

Suppose we change the Account Name to “Name Updated”.

e5

We can even add any new records by adding data in the next row and saving the excel back to CRM.

e6

The record would be created in CRM when we click “Save the changes back to CRM”.

e7

You can see the record is created in CRM as below:

As soon as we click the “SAVE CHANGES TO CRM” following dialog shows up

e8

We can check the status of importing process at “Settings/ Data Management/Imports”.

e9

We can monitor the Import Job status from the Import Job. It shows the Creates and Updates performed in CRM due to the import. In our case it shows “Create” and “Update” as follows:

e10

Once the import job successfully completes, you can see the updates reflected in CRM. The Failures if any can be monitored in the job as well.

Security:

In order to use this functionality the user must have “Export to Excel” privilege.

e11

It appears you do not need to have an active Excel Online subscription for this to work. This was tested on an Org that did not have any active Office subscription.

Conclusion:

Easy to use, bulk editing tool with the power of Excel is now in your hands with this feature.

Hope it helps!

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Immersive Excel Experience with Dynamics CRM 2015 Online Update 1 appeared first on Inogic Blog.

Keywords : Dynamics CRM, CRM 2015, Dynamics CRM 2015 online Update 1


Calculated fields support extended for Date/Time data types in Dynamics CRM 2015 Online Update1

$
0
0

Introduction:

Calculated fields was first introduced in Dynamics CRM 2015 and it further improved upon the ability to provide codeless solutions to power users to configure. You can learn more about its features from our earlier blog here.

It provided support for most CRM data types however the calculations and formulae supported for Date/Time fields were still limited.

With the latest Online update, they have enhanced the operations supported on Date/Time fields.

  1. DIFFINDAYS(start date or time, End date or time)
  2. DIFFINHOURS(start date or time, End date or time)
  3. DIFFINMINUTES(start date or time, End date or time)
  4. DIFFINWEEKS(start date or time, End date or time)
  5. DIFFINYEARS(start date or time, End date or time)
  6. DIFFINMONTHS(start date or time, End date or time)

The Rollup field has also been enhanced to support AVG as an aggregate calculation for Date/Time fields.

How does this help?

A very real scenario where this code be used is to calculate the Avg. time it takes for resolving a complaint.

The Actual Units fields in the Case entity calculates the total time spent on the case by adding up the times on the individual activities associated with the case. But what if you wanted to know just how long a case had been open – case createdon – case modifiedon.

Next it would be good to have the Avg. case resolution time per customer, to monitor if there are particular customers for which is usually takes too long to close a case. What we are looking out for here is Avg. Case closure time.

Walkthrough

Let us see how to go about getting this set up in no time.

  1. Add the Calculated field.

calculated fields

Since we have created a Duration field, we would calculate the difference between CreatedOn and ModifiedOn in minutes. Note. Duration field always expects the values to be provided in minutes.

calculated fields1

  1. Create the Rollup field.

              We will add the rollup field on Account to get the Avg. Resolution time.

calculated fields2

                       Rollup the time for only resolved cases.

calculated fields3

  1. Place both the fields on the Case and Account forms respectively.
  2. Now when you resolve the case, you will find that the case resolution time is auto calculated.

calculated fields4

  1. We quickly closed a few cases for this account so that the avg. could be calculated

calculated fields5

  6.   Now lets check how it looks on the Account form

calculated fields6

Conclusion:

Though this takes a step further in supporting date/time data type in Calculated and Rollup fields, Rollup fields still do not support Date conditional operators like Last X months/years etc. So if I wanted to get the avg. case closure time in the last 6 months, I still cannot do that. Hoping to see this included in future version to support a full code-less power-user configuration solution.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Calculated fields support extended for Date/Time data types in Dynamics CRM 2015 Online Update1 appeared first on Inogic Blog.

Keywords : Calculated field, Dynamics CRM 2015, Date/Time data types, Dynamics CRM 2015 Online update 1, 

Accessing related entities fields in Calculated Fields formulas in Microsoft Dynamics CRM 2015

$
0
0

Introduction:

In our recent blog post about calculated fields we have covered about calculated fields support extended for Date/Time data types in Dynamics CRM 2015 Online Update 1. You can read this blog here. In this blog we will focus on accessing related entities fields in calculated fields formulas.

In Calculated fields, you can define the formula at the time of adding the field itself. This ensures it is executed at all times, server-side. But since it is updated synchronously you can see the updates immediately upon save.

Calculated fields can only use N:1 look up fields. We cannot use N:N or 1:N relationship for Calculated fields.

Walk-through:

Let’s see how we can use related entities look up fields in calculated fields formula.

Consider an example where we need to calculate the Budget for Opportunity Entity using the formula:

Budget(Opportunity)=Budget(Account) – ( Budget(Account)*0.002)

To accomplish this,

1. We will first create Budget field as calculated field on Opportunity Entity. As we createBudget field as Calculated Field it becomes read only on the form.

calculated field         

2. To define the calculation for Budget field click on Edit button that appears only when Field type is Calculated or Rollup.

calculated field1

This opens a UI similar to Business Rules where we can define calculation.

calculated field2

3. When setting the action and formula, you get intellisense to support the common functions. Using the intellisense, we can use the related entity by using the lookup fields name of that entity.calculated field3

4. The lookup fields name allows access to all fields of the look up entity.calculated field4

5. For above requirement we have defined the conditions and actions as below:calculated field5

Now, when you create a new record, upon Save you will find the Budget automatically set.

Conclusion:

With this extended support we can perform calculations that require related entities fields using calculated fields.

Stuck with migration to Dynamics CRM? Experts at Inogic are always happy to help you, get in touch with us on crm@inogic.com.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Accessing related entities fields in Calculated Fields formulas in Microsoft Dynamics CRM 2015 appeared first on Inogic Blog.

Converting Date/Time based on user timezone in SSRS reports for Dynamics CRM Online

$
0
0

Converting Date/Time values according to a timezone is quite easy in languages like javascript, C#, etc. but achieving this in SSRS reports is a challenging task. For CRM online we can achieve this using CRM parameter in SSRS reports.

We have covered a work around to achieve this functionality in SSRS reports for CRM online.

Scenario:

We had a request from one of our clients in which the client used to run a report on the last day of every month.

The client used to pay commisions to the users as per the goals achieved by them in the month, so he runs the report on the last day of the month. Somehow the report when ran didn’t show the proper data and the reason was the timzone difference between the user and the UTC timezone.

Since the report was made to show records of the current month so when the client ran the report on May 31 it unexpectedly showed the details of June because till that time the date has changed to June 01 in UTC.

Resolution:

After so much googling also we could not find a way to tackle this situation. So we tried to know the principles used in the OOB reports of CRM to handle this situation as they always run without any issues and show the perfect data all the time.

To know what is the logic used in the OOB reports we downloaded the Account Summary report available in system and we found two things that are used to achieve this functionality:

  1. CRM parameter: CRM_UserTimeZone
  2. Assembly reference:Crm.Reporting.RdlHelper

To incorporate these changes in our report we created a parameter CRM_UserTimeZone to store the user time zone as shown below:

report

After adding the parameter in the report we need to add the assembly refrence, to add the refrence go to Report Properties and click on the References tab. Now click on the Add button, since the assembly we need to add in the report is only available on the reporting server so we cannot browse and add a URL to it.

To overcome this we need to just paste the following URL in the browse textbox as shown below:

URL: Microsoft.Crm.Reporting.RdlHelper, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

The above URL is found in the refrences of the Account Summary report.

report1

After adding the assembly reference we need to initialize a variable which will contain the user current datetime. To do this we use the following code:

=CDate(Microsoft.Crm.Reporting.RdlHelper.DateTimeUtility.ConvertUtcToLocalTime(DateTime.UtcNow, Parameters!CRM_UserTimeZoneName.Value))

In the above code, we have converted the UTC time to user local time using theCRM_UserTimeZoneName parameter so it provides us the flexibility to run the report on the last day of each month.

Note: If we run this report in the dev machine then it gives an error of missing references as shown below:

report2

But when this report is rendered in the online environment then it loads the referenced assembly from the CRM online environment and shows the proper data.

report3

Summary

It is clear from the above example that we can use the CRM parameters to make our reports user-friendly and to show user-specific data.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Converting Date/Time based on user timezone in SSRS reports for Dynamics CRM Online appeared first on Inogic Blog.

Querying More than 5000 records in Dynamics CRM

$
0
0

Introduction

There are multiple ways provided in Dynamics CRM SDK to query and read data like

  1. Using ODATA
  2. Using FetchXML
  3. Using Query object

ODATA has a limitation where it can return only 50 records at a time. You can ofcourse query more than that but it would be in batches of 50 records at a time.

Fetch XML queries on the other hand will allow you to read upto 5000 records in one go with the ability to read the next 5000. Since requesting 5000 records at a time may not really be a good idea because of the network resources that would use and potentially slow down or even time out depending on the network speeds, it is always a good idea to read data in small manageable sets of records. Fetch queries when executed return paging cookies when you implement paging and this helps you to implement a system where you would like to read a fixed count of records and provide a next/prev button to access additional records.

Query Records using Fetch

<fetch mapping=”logical” output-format=”xml-platform” version=”1.0″ page=”1″ paging-cookie=”” >

<entity name=”account” >

<attribute name=”name” />

<attribute name=”address1_city” />

<order descending=”false” attribute=”name” />

<filter type=”and” >

<condition attribute=”ownerid” operator=”eq-userid” />

<condition value=”0″ attribute=”statecode” operator=”eq” />

</filter>

<attribute name=”primarycontactid” />

<attribute name=”telephone1″ />

<link-entity visible=”false” name=”contact” link-type=”outer” to=”primarycontactid” from=”contactid” alias=”accountprimarycontactidcontactcontactid” >

<attribute name=”emailaddress1″ />

</link-entity>

<attribute name=”industrycode” />

<attribute name=”donotbulkemail” />

<attribute name=”creditonhold” />

<attribute name=”accountid” />

</entity>

</fetch>

The above code works fine as long as there are less than 5000 records in the system. When the records fetched count went above 5000+ records we started getting following error:

report

So if you notice in our above fetch xml we are providing “paging-cookie” as blank. So once the records retrieved count goes above 5000+ records we started getting the above shown error. For Fetch to bring records above 5000+ it requires paging-cookie to be set in the fetch tag

Setting the Paging Cookie

Where do we find the paging cookie?  The answer is fetch response. Whenever we make a fetch request the response which we get back from fetch has paging-cookie in it. We need to extract that paging-cookie from response which we can send to our next page fetch request. In addition to paging-cookie we also get “MoreRecords” which is Boolean which tells us if there are any more records to fetch.

When we are on first page we provide the paging-cookie as blank as the first page doesn’t need a paging-cookie. When the fetch query is executed it brings the page-cookie with it in the resultant response which looks like this:

“<cookie page=\”1\”><name lastnull=\”1\” firstnull=\”1\” /><accountid last=\”{98B36F67-3A21-E511-80FC-C4346BAD2660}\” first=\”{A6B16F67-3A21-E511-80FC-C4346BAD2660}\” /></cookie>”

To get this page-cookie from response we extract it from resultant fetch response as follows:

Var pagecookie = $(resultXml).find(“a\\:PagingCookie”).eq(0)[0].text;

You can find that since we are on first page it returns the page as “1”. Since the fetch is for “Account” entity it returns the first accountid and last accountid for that page in page-cookie. When we request for the next page we provide this page-cookie from first page to the next page fetch query request.

In the same way we can extract “MoreRecords” as follows:

Var moreRecords = $(resultXml).find(“a\\:MoreRecords”).eq(0)[0].text

This returns “true” or “false” which helps us to determine if we reached last page or still there are any records to fetch.

Updated Code

var xmlDocument = parser.parseFromString(fetchxml, “text/xml”);

var fetch = $(xmlDocument).find(‘fetch’);

fetch.attr(‘page’, page);

fetch.attr(‘count’, pageCount);

fetch.attr(‘paging-cookie’, pagingCookie);

In above code we are providing “pagingCookie” variable to which we set the page-cookie which we get from response in fetch attribute along with page and pagecount.

So now when you checkout the fetch query it be as follows :

<fetch count=”250″ mapping=”logical” output-format=”xml-platform” version=”1.0″ page=”18″ paging-cookie=”&#60;cookie page&#61;&#34;1&#34;&#62;&#60;name lastnull&#61;&#34;1&#34; firstnull&#61;&#34;1&#34; &#47;&#62;&#60;accountid last&#61;&#34;&#123;98B36F67-3A21-E511-80FC-C4346BAD2660&#125;&#34; first&#61;&#34;&#123;A6B16F67-3A21-E511-80FC-C4346BAD2660&#125;&#34; &#47;&#62;&#60;&#47;cookie&#62;” /></cookie>”>

<entity name=”account” >

<attribute name=”name” />

<attribute name=”address1_city” />

<order descending=”false” attribute=”name” />

<filter type=”and” >

<condition attribute=”ownerid” operator=”eq-userid” />

<condition value=”0″ attribute=”statecode” operator=”eq” />

</filter>

<attribute name=”primarycontactid” />

<attribute name=”telephone1″ />

<link-entity visible=”false” name=”contact” link-type=”outer” to=”primarycontactid” from=”contactid” alias=”accountprimarycontactidcontactcontactid” >

<attribute name=”emailaddress1″ />

</link-entity>

<attribute name=”industrycode” />

<attribute name=”donotbulkemail” />

<attribute name=”creditonhold” />

<attribute name=”accountid” />

</entity>

</fetch>

Note:

Make sure to encode the fetchxml request to cover for any special characters in the data. Let us explain with an example, for one of the result sets of the above fetch we found the paging-cookie received a special character – single quote (‘) in one of the records name field. This field was referenced in the paging-cookie.

Example:

“<cookie page=\”2\”><fullname last=\”Susan’s Burk (sample)\” first=\”Rene Valdes (sample)\” /><contactid last=\”{349DB5FF-DA1B-E511-80F1-C4346BACD1A8}\” first=\”{2E9DB5FF-DA1B-E511-80F1-C4346BACD1A8}\” /></cookie>”

In above example you can see that the fullname last=\”Susan’s Burk (sample)\” has (‘s). This (‘) used to break the fetchxml and hence started throwing “Page Cookie Malformed” exception when trying to execute fetchxml request.

To resolve this you need to encode the paging-cookie before it is insert in the fetch xml.

Traversing backwards

Using the paging-cookie you can traverse forward to the next set of results. But if you want to implement the previous button or you want to allow navigation to a specific page, you need to make sure you store the paging-cookie received for each of the pages.

To deal with this you can save the page-cookie for example in the array for the pages which you move forward and use this later to get the page-cookie for that particular page when moving backward in paging.

Conclusion

Using Paging-cookies effectively, you can implement paging without actually retrieving all the records at one-go. Query records only when requested and display for better performance results.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Querying More than 5000 records in Dynamics CRM appeared first on Inogic Blog.

Business analytics using Maps in Dynamics CRM

$
0
0

This is Part 2 of our Maplytics solution series, which allows you to integrate your Dynamics CRM with Bing Maps for all entities. In Part 1, we saw replies to some of common FAQ’s on the solution. Today let’s see some features and how adding this solution to your CRM can help you analyze your business in a much better way and help you provide Smart Customer Service. We use maps for our daily use, so why not for business.

Maplytics is used across all industries and by all roles. Ofcoz the two most common people in your organization who would use this often is the Manager and the Salesperson. Lets see what one of them has to say..

Manager - We never thought Maps could be so useful until we started using them for our business. Its now become more like an analytical tool for me. Our business is spread across cities and this helps us to keep a tab on things like service requests in an area, complaints from any area or maybe whereabouts of the daily schedule planned by my service technicians. Its all there now right in front of me in my crm. I love the heat maps in it.

Salesperson – Planning meetings is no longer a challenge. Now we can plot any entity on Bing Map from within Microsoft Dynamics CRM and make plans, print and go. The Proximity search feature in Maplytics allows us to search records within a given radius of a location. And yes, we can now find nearest meeting spots like a Starbucks or an airport quickly.

A little more about why we innovated Maplytics and its features:-
Product Page – http://inogic.com/Product/76/Integrations/Maplytics
Video – https://www.youtube.com/watch?v=UgWslSIv5MM

Why Maplytics

Mapping is like changing the game in CRM. Mapping inside of Dynamics CRM goes a step further by showing your users the way to make better business decisions. From simply having a better understanding of your data to making better, more-informed business decisions – maps have the power to transform your business. 

maplytics

Maplytics Features:

1. Plot any entity: Maplytics supports for all entities in Dynamics CRM. User can plot any entity on Bing Map from within Microsoft Dynamics CRM.
2. Save geographical search: Maplytics allows user to save geographical search results. The search results can be saved as static personal views in CRM.
3. Heat Maps: Maplytics also support Heat Maps. Heat maps helps to understand the concentration of your biggest accounts, opportunity, hot leads or any other entity.
4. Color coding of pushpins: With Maplytics user can color code pushpins based on configurable categorization in Microsoft Dynamics CRM.
5. Search records: Maplytics provides the ability to search records within a given radius of a location.
6. Print and Export search results: Maplytics allows to print or export search results to an external file.

Want to know more, why not just see a live demo or opt in for our 15 days fully functional trial. Email us on crm@inogic.com with your CRM version.

There's much more, for more Dynamics CRM Tips and Tricks head on to Inogic Blog. If you have any questions on Dynamics CRM or need any help in implementaion, customization, upgradation of Dynamics CRM or are looking to get more out of your CRM, feel free to reach us at crm@inogic.com today!

The post Business analytics using Maps in Dynamics CRM appeared first on Inogic Blog.

Viewing all 3363 articles
Browse latest View live