Notes for development in MS CRM 2011

1) IntelliSense for JavaScript (detail instruction in Russian)

2) JScript Editor Extensions (http://visualstudiogallery.msdn.microsoft.com/872d27ee-38c7-4a97-98dc-0d8a431cc2ed/)  для Visual Studio 2010.

3) IntelliSense также можно задейстовать и для редактирования файла Ленты (Ribbon)

4) Source

System Types

CRM 2011 позволяет работать с типами .Net Framework вместо того, чтобы использовать CRM-специфичные типы (вроде CrmNumber). Следующая таблица показывает сопоставление между типом атрибутов старой и новой версией CRM:

Attribute Type Microsoft Dynamics CRM 2011 Type Microsoft DynamicsCRM4.0 Type
Boolean bool or System.Boolean CrmBoolean
CalendarRules EntityCollection DynamicEntity[] or calendarrule[]
Customer EntityReference Customer
DateTime System.DateTime CrmDateTime
Decimal decimal or System.Decimal CrmDecimal
Double double or System.Double CrmFloat
Integer int or System.Integer CrmNumber
Internal System.Object
Not used in records.
Not used in records.
Lookup EntityReference Lookup
Memo string or System.String System.String
Money Money CrmMoney
Owner EntityReference Owner
PartyList EntityCollection or ActivityParty[] activityparty[] or DynamicEntity []
Picklist OptionSetValue Picklist
PrimaryKey System.Guid Key
String System.String System.String
State OptionSetValue or enumeration generated for the entity state EntityNameStateInfo
Status OptionSetValue orint Status
Uniqueidentifier System.Guid UniqueIdentifier
Virtual System.Object
Not used in records.
Not used in records.

5) Как включить трассировку : http://support.microsoft.com/kb/907490/en-us

6) Debug page
Debug page – это ASPX-страница, которая имеется в каждой CRM-среде и которая содержит базовую информацию в Вашем CRM развертывании.
Найти ее можете по адресу:1 http://ServerName:Port/OrgName/home/home_debug.aspx
В результате Вы получите информацию о DataSource, версиях компонентов, OrganizationID, и т.д.

7) hide show tab &  section on ms crm 2011

hide a tab
var tabs = Xrm.Page.ui.tabs.get();
tabs[n].setVisible(boolean);
where n  is the index value of the tab, starts from 0
and boolean is true or falsehide a section
var sections = Xrm.Page.ui.tabs.get(n).sections.get();
sections[m].setVisible(boolean);
where n  is the index value of the tab, starts from 0
m  is the index value of the section in the tab, starts from 0
and boolean is true or false
 enable/disable a filed in ms crm 2011

Xrm.Page.ui.controls.get(“<attribute_name>”).setDisabled(true);//will disable the field
Xrm.Page.ui.controls.get(“<attribute_name>”).setDisabled(false);// will enable the field

8) CRM 2011 – Quick tip – Javascript to stop a form saving
by Hosk
This is probably something you will need to do at some point. You want to validate a page and if it doesn’t fit certain criteria then the form should not be saved until the user has met your criteria.
To stop the save event in Javascript all you need is this
event.returnValue = false;
Tanguy the CRM tool guy (and CRM MVP) put something very interesting in the comments but I thought I would promote it to this very small blog post
The new method in CRM 2011 is the following one:
Xrm.Page.context.getEventArgs().preventDefault();
preventDefault : Cancels the save operation, but all remaining handlers for the event will still be executed.
9)  case resolution form can not be customized in ms crm 2011

10) Is there any supported way to hide/disable left navigation bar on some condition in MS CRM 2011?
        11.1) Exclude weekends from workflow
           The Workflow Manipulation library on codeplex will deal with this just as you describe. If you keep your office opening times up to date with public holidays etc, it will factor those in too.
http://manipulationlibrary.codeplex.com/
16 SSRS reports on crm 2011 dashboard
18) What is inside a CRM 2011 Solution file anyway? (CRM 2011 Solution Exposed)
Dynamics CRM 2011 introduced us to Solutions, which are self-contained packages of components, customize CRM 2011 to add specific features and/or entities.
20) Report of who an account is shared with
We are doing major restructuring of our accounts and have a lot of sharing of accounts and other entities. Can anyone suggest how we can produce a report that shows by account everyone the account is shared with? If I could find a technical reference regarding how this is stored in the system it would be great!
Mike Feingold • Look in the PrincipalObjectAccess view. This is where CRM stores data about record sharing.
22) Async Operation failed  (by Rami Heleg)
Async Operation failed and I want to get the reason.
Run this SQL and read the messageUSE ORG_MSCRM
SELECT createdon,message,PrimaryEntityType,Name,Depth FROM AsyncoperationBase
WHERE statecode = 3 AND statuscode = 31 AND Deletionstatecode = 0
ORDER BY createdon DESC
VIEW THE ERROR IN message.
28) Programmatically Sharing a Record in CRM 2011 
how to share a record programmatically To share a record we need to use these namespaces using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Client; using Microsoft.Crm.Sdk.Messages;
44) Filter lookup programatically using javascript on CRM formhttp://crmdynamicblog.blogspot.com/2012/05/filter-lookup-programarically-using.html
49) support/unsupport – table with lists
57) New Users Problem in CRM 2011 we are shifting to CRM 2011 hosted on premise, I am currently creating new user profiles to all workers, and assigning them their security roles.
we have noticed that the new users are unable to edit/create records, although previous users with the same security role and under same team are able to do the work just fine.
all users have Read/Write Access Mode and Full License Mode.
Any ideas what might be the problem? do you think it is a CRM issue or SQL issue when creating the user login?
>>>  Problem solved !
First of all,  i was using Based Authentication, and the problem was not in my Active directory.
Turns out it was a simple feature in the security role (Daaa!)
under the Core Records Tab, i had to check the User Entity UI Settings 🙂
It took me almost three days to finally realize the mistake 🙂
         1) as far as I am aware, you cannot directly manipulate forms via the CRM SDK.What you could do, however, is use the SDK to export the solution, unpackage it using the SolutionPackager.exe file (included with the SDK), and then add an attribute to the appropriate form xml file (depending upon which form you want to edit).Then you can use SolutionPackager.exe to package up all of the components again and then import that using the SDK.Its a bit long winded, but it works – I have had to do this before.
      2)You can reference this SDK section: http://msdn.microsoft.com/en-us/library/gg334527.aspx
for the XML schemas.You can retrieve the actual XML with the following code that queries the systemform entity . Once you’ve got it, you will have to parse it out and add elements as required based on the schema. Then update the systemform using the updated string and publish.You can look through the source code of this project to see it done: http://xrmspeedy.codeplex.com/QueryExpression query = new QueryExpression
{
EntityName = “systemform”,
ColumnSet = new ColumnSet(“formxml”)
};ConditionExpression expression1 = new ConditionExpression(“type”, ConditionOperator.Equal, 2);
ConditionExpression expression2 = new ConditionExpression(“objecttypecode”, ConditionOperator.Equal, 1); // 1 = Accountquery.Criteria.AddCondition(expression1);
query.Criteria.AddCondition(expression2);RetrieveMultipleRequest rmRequest = new RetrieveMultipleRequest { Query = query };

var rmResponse = (RetrieveMultipleResponse)service.Execute(rmRequest);
string formXml = rmResponse.EntityCollection.Entities.FirstOrDefault().Attributes[“formxml”].ToString();

 

63. CRM 2011 – Find “Unused” Custom Fields via SQL

>>Another way to identify the unused fields would be to leverage the Metadata Document Generator found in the free XrmToolbox solution on CodePlex. Here’s a blog post I wrote that includes this step: http://niiranen.eu/crm/2014/03/spring-cleaning-dynamics-crm/

64.   how can i query maximum size limit of attachment from crm – as we go to system setting — in email tab thier is file size limit i want to make query using code in plugin.

A>> You can use the Organization.MaxUploadFileSize property since you don’t have access to the database; which would be:

SELECT TOP 1000 [Id]
,[ColumnName]
,[BigIntColumn]
,[IntColumn]
,[SmallIntColumn]
,[TinyIntColumn]
,[BitColumn]
,[FloatColumn]
,[DateTimeColumn]
,[SmallDateTimeColumn]
,[NVarCharColumn]
,[UniqueIdentifierColumn]
,[VarBinaryColumn]
,[Encrypted]
FROM [MSCRM_CONFIG].[dbo].[ServerSettingsProperties] NOLOCK
where ColumnName like ‘ImportMaxAllowedFileSizeInMB’

65)  Scheduling Recurring Workflows in Microsoft Dynamics CRM 2011 Online and On-Premise

Linkedin arcticle

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: