Friday, October 10, 2014

CRM System User settings information

Each CRM user has got different set of user settings. If we need to change the user settings for a particular person we need to log in the system using their credentials and then we would have to change it. But is this possible?

We don’t get the user credentials of the clients as they are private. So if we need to do an update then we have to do it without having the credentials of the client. How is this possible.
You can update the table which has this information. The table is usersetting table. You can link this with the systemuser table to find out about the person you are trying to update.


Please do note this is unsupported and cannot be done with CRM online applications.

Monday, September 22, 2014

CRM Plugin Deployment Error From Visual Studio

When I tried to deploy the plugin dll from the tool deploy feature I got the following error.

Error      138         Error registering plugins and/or workflows. The resource string "ErrorSerializingRegFile" for the "RegisterPlugin" task cannot be found. Confirm that the resource name "ErrorSerializingRegFile" is correctly spelled, and the resource exists in the task's assembly.  C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.12.targets             176        

When checked in google I was able to find the resolution and it was because RegisterFile.crmregister has not been checked out. When trying to deploy it is writing to this file and since it has not been checked out it is giving an error.


This article talks about it

Monday, September 15, 2014

Full name field format on Contact entity

This is a question most of the people do have when it comes to the full name field. There are questions like can the first name, middle name and last name be taken together to form this.
Most of the people try to write a custom plugin to do this, but have issues.

If this is the case is there a way we can achieve this using OOTB functionality?

The answer is Yes. You can do this by changing a value from the system settings.
How to do this?

Go to Settings in CRM and choose Administration and click on System Settings.
From the General Tan Select the full name format you need from the drop down below.



Tuesday, September 9, 2014

Odata Query to Retrieve Information from a self-reference Query

Using the expand term with CRM 2011 and 2013 Odata queries we can bring the related entities required field values. There is a limitation for 6 relationships.

E.x: -
If you want to retrieve the parent contact name when retrieving the accounts then you can easily use this.

https://localhost/OrgName/XRMServices/2011/OrganizationData.svc/AccountSet?$select=AccountId,AccountNumber,Name,Address1_Composite,Telephone1,EMailAddress1,account_primary_contact/FullName&$expand=account_primary_contact

However if you want to retrieve information from a self-reference this method would not work. Microsoft has mentioned this in the below link.


The conceptual schema definition language (CSDL)  element includes all the 1:N, and N:N relationships for the entity. If the relationship represents a self-referencing relationship, there will be two  elements for this relationship. The name of the relationship uses the prefix Referenced and Referencing to differentiate the role a specific record plays in the relationship. For more information, see Types of Entity Relationships.

An example of how this can achieved is given below. This has been written to the default account self reference.


https://localhost/OrgName/XRMServices/2011/OrganizationData.svc/AccountSet?$select=AccountId,AccountNumber,Name,Address1_Composite,Telephone1,EMailAddress1,Referencingaccount_parent_account/Name&$expand=Referencingaccount_parent_account

Wednesday, August 27, 2014

A Query Expression with type array being passed to a condition expression

In a conditional expression when the condition type is in you can pass an array of values. This array of values has to be properly formatted before giving in.
For an example.

query.Criteria.AddCondition(
“fieldname”,
                ConditionOperator.In,
                new object[] { "d39ecf98-3e07-e411-a3a1-00155d005107", "28c5f748-8805-e411-a3a1-00155d005107" }
                );

What if you had the values in a GUID array and if you write this in the following manner.

query.Criteria.AddCondition(
“fieldname”,
                ConditionOperator.In,
                new object[] { "d39ecf98-3e07-e411-a3a1-00155d005107", "28c5f748-8805-e411-a3a1-00155d005107" }
                );
You will be getting an error saying where Guid is expected you are giving a Guid array.

Can we sort this out without have to go through the array and create a comma separated string?
The answer is yes, we can. We can use the first written statement and then doing another change would enable us to achieve that.
link.LinkCriteria.AddCondition(new ConditionExpression(
“fieldname”,
                ConditionOperator.In,
                ids)
                );


How this is possible? The condition expression has overloads which expects an array of objects. So this allows you do this because of that. 

Thursday, February 6, 2014

Update Emails to sent Status in CRM 2011

When working with emails in CRM most of the time we test with the email router being turned off. While this is good sometime we face an issue when we have to turn this on. We can either
  • Delete all the emails OR
  • Change the status of emails to Sent so that emails would not fire from Email router once we turn on the email router.


Most of the clients would prefer the second option as they would be able to keep the ones which have already being created. So how can we do this?
There is a simple database update which allows us to do this. After executing that you are good to go with email router turning on.
Status code = 3 (Sent)
State code = 1 (Completed)
Object Type Code = 4202 (Email Entity)


update ActivityPointerBase 
set StatusCode = 3,
StateCode = 1

where dbo.ActivityPointerBase.ActivityTypeCode = 4202

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...