Plugins (both sync and async) are not supposed to be long-running processes and therefore there is a 2 minute timeout. I think you should reconsider your design to use a workflow (perhaps with a custom workflow activity) to solve your problem. Only workflows are allowed to execute for unlimited amount of time. However, because custom workflow activities are not supported in CRM Online you might have to consider using Azure.
Reference:
http://social.microsoft.com/Forums/sv-SE/crmdevelopment/thread/63430219-4262-47ae-8184-db1d82c4473e
Side track read: CRM 2011 Online: Why custom workflow assemblies are not supported
Showing posts with label Crm. Show all posts
Showing posts with label Crm. Show all posts
Sunday, 4 March 2012
Sunday, 26 February 2012
Crm 2011 Auditing Report
Unfortunately the Audit entity does not not have a Filtered view in the database. Also, there is no support for advanced find and the like.
Therefore there is no supported way to create a report that runs on the audit entity.
If you are working with Dynamics CRM 2011 On Premise you could go for the unsupported solution provided by daemon lin in this thread:
Query the table AuditBase (or the Audit view) in combination with the [MetadataSchema].[Attribute] table and the [MetadataSchema].[Entity] table to translate the AttributeMask (separated with ',') in AuditBase using Attribute.ColumnNumber = (the number in AuditBase.ChangeData), Attribute.EntityId = Entity.EntityId and Entity.ObjectTypeCode = AuditBase.ObjectTypeCode into the attribute names (You can get the display name using [MetadataSchema].[LocalizedLabel]). The corresponding changed values are in AuditBase.ChangeData seperated by ~. Operation is an optionset (1=Create, 2=Update, 3=Delete)
Note that security will NOT be applied on the data. Security Roles are not taken into account in this query. (In contrast, Filtered views always apply security for the current user)
Remember that in this case you are working in an unsupported mode and that a CRM update may break your report. Make sure to document that you did this.
If you are working with CRM 2011 Online: there is no way to create a complete report using SSRS. SSRS in CRM Online cannot directly access the database and the Audit Entity is not entirely exposed through web services which is required if you want to create a FetchXml based Report. (e.g. the ChangeData column that contains the changed data is not valid for read; you would have no easy option to translate the attributemask into corresponding field names.)
In All Cases: you can always work with filtering on the Audit Summary View (Settings > Auditing > Audit Summary View)
http://social.microsoft.com/Forums/en/crmdevelopment/thread/b3bcc68b-88e4-4c1e-af96-dc645b34bbe7
http://marcuscrast.wordpress.com/2012/01/14/dynamics-crm-2011-audit-report-in-ssrs/
http://www.avanadeblog.com/xrm/2010/09/crm-2011-feature-of-the-week-9132010-auditing.html
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/a11cf7b2-3f5a-4f2b-b97d-9ca56a0c5aab
Therefore there is no supported way to create a report that runs on the audit entity.
If you are working with Dynamics CRM 2011 On Premise you could go for the unsupported solution provided by daemon lin in this thread:
Query the table AuditBase (or the Audit view) in combination with the [MetadataSchema].[Attribute] table and the [MetadataSchema].[Entity] table to translate the AttributeMask (separated with ',') in AuditBase using Attribute.ColumnNumber = (the number in AuditBase.ChangeData), Attribute.EntityId = Entity.EntityId and Entity.ObjectTypeCode = AuditBase.ObjectTypeCode into the attribute names (You can get the display name using [MetadataSchema].[LocalizedLabel]). The corresponding changed values are in AuditBase.ChangeData seperated by ~. Operation is an optionset (1=Create, 2=Update, 3=Delete)
Note that security will NOT be applied on the data. Security Roles are not taken into account in this query. (In contrast, Filtered views always apply security for the current user)
Remember that in this case you are working in an unsupported mode and that a CRM update may break your report. Make sure to document that you did this.
If you are working with CRM 2011 Online: there is no way to create a complete report using SSRS. SSRS in CRM Online cannot directly access the database and the Audit Entity is not entirely exposed through web services which is required if you want to create a FetchXml based Report. (e.g. the ChangeData column that contains the changed data is not valid for read; you would have no easy option to translate the attributemask into corresponding field names.)
In All Cases: you can always work with filtering on the Audit Summary View (Settings > Auditing > Audit Summary View)
http://social.microsoft.com/Forums/en/crmdevelopment/thread/b3bcc68b-88e4-4c1e-af96-dc645b34bbe7
http://marcuscrast.wordpress.com/2012/01/14/dynamics-crm-2011-audit-report-in-ssrs/
http://www.avanadeblog.com/xrm/2010/09/crm-2011-feature-of-the-week-9132010-auditing.html
http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/a11cf7b2-3f5a-4f2b-b97d-9ca56a0c5aab
Saturday, 25 February 2012
Crm 2011 Developer Toolkit - How to exclude a resource file from a crm deployment package?
Please note the properties window of the web resource file. If you set the Build Action to None, the resource will NOT be deployed to Crm
Wednesday, 22 February 2012
How to do AllColumns for ColumnSet for Crm 2011
new Microsoft.Xrm.Sdk.Query.ColumnSet(true) is equal to new AllColumns() in CRM 4.0.
Thursday, 16 February 2012
How does Crm smart matching work? smart matching rules and logic
How does smart matching work:
Smart matching relies completely on the existence of similarity between emails. The subject and recipients (from, to, cc and bcc) list are the two important components that are considered with checking for similarity.
When an email is sent from CRM, there are two sets of hashes generated for it and stored in the database.
a. Subject hashes:
To generate subject hashes, the subject of the email, which may include the CRM token if its usage is enabled in system settings, is first checked for noise words like RE: FW: etc. The noise words are stripped off the subject and then tokenized. All the non empty tokens (words) are then hashed to generate subject hashes.
b. Recipient hashes:
To generate the recipient hashes the recipient (from, to, cc, bcc) list is analyzed for unique email addresses. For each unique email address an address hash is generated.
Next when an incoming email is tracked (arrived) in CRM, the same method is followed to create the subject and recipient hashes.
To find the correlation between the incoming email and the outgoing email the stored subject and recipient hashes are searched for matching values. Two emails are correlated if they have the same count of subject hashes and at least two matching recipient hashes.
http://community.dynamics.com/roletailored/customerservice/b/cscrmblog/archive/2008/11/11/microsoft-dynamics-crm-email-correlation-and-smart-matching.aspx
http://blogs.msdn.com/b/crm/archive/2008/01/29/what-s-new-in-microsoft-dynamics-crm-4-0-e-mail-integration.aspx
Smart matching relies completely on the existence of similarity between emails. The subject and recipients (from, to, cc and bcc) list are the two important components that are considered with checking for similarity.
When an email is sent from CRM, there are two sets of hashes generated for it and stored in the database.
a. Subject hashes:
To generate subject hashes, the subject of the email, which may include the CRM token if its usage is enabled in system settings, is first checked for noise words like RE: FW: etc. The noise words are stripped off the subject and then tokenized. All the non empty tokens (words) are then hashed to generate subject hashes.
b. Recipient hashes:
To generate the recipient hashes the recipient (from, to, cc, bcc) list is analyzed for unique email addresses. For each unique email address an address hash is generated.
Next when an incoming email is tracked (arrived) in CRM, the same method is followed to create the subject and recipient hashes.
To find the correlation between the incoming email and the outgoing email the stored subject and recipient hashes are searched for matching values. Two emails are correlated if they have the same count of subject hashes and at least two matching recipient hashes.
http://community.dynamics.com/roletailored/customerservice/b/cscrmblog/archive/2008/11/11/microsoft-dynamics-crm-email-correlation-and-smart-matching.aspx
http://blogs.msdn.com/b/crm/archive/2008/01/29/what-s-new-in-microsoft-dynamics-crm-4-0-e-mail-integration.aspx
Tuesday, 14 February 2012
CRM 2011 How to change ownership of an entity after creation. Clone an entity
Issue:
Has anyone tried changing the ownership type of an entity from organisation to user in CRM 2011 before?
As there are hundreds of fields on the entities’ form already, I’d like to save time on recreating entity if possible.
Solution:
You could export all the entity fields and re-import them to the new user-owned entity, creating them during import. Far quicker than doing it manually.
Step1: Create the entity first without adding any fields and select the entity type to be either org or user.
Step2: Using data import wizard (NOT solution import) to create the rest of the fields. Be careful with the Guid in the lookup fields. They have to exist in the target crm org.
Step3: Tidy up the forms
http://www.youtube.com/watch?v=hZVFXFZ5tUU
Has anyone tried changing the ownership type of an entity from organisation to user in CRM 2011 before?
As there are hundreds of fields on the entities’ form already, I’d like to save time on recreating entity if possible.
Solution:
You could export all the entity fields and re-import them to the new user-owned entity, creating them during import. Far quicker than doing it manually.
Step1: Create the entity first without adding any fields and select the entity type to be either org or user.
Step2: Using data import wizard (NOT solution import) to create the rest of the fields. Be careful with the Guid in the lookup fields. They have to exist in the target crm org.
Step3: Tidy up the forms
http://www.youtube.com/watch?v=hZVFXFZ5tUU
Thursday, 9 February 2012
Dates Fields and Time Zones in CRM
As we pick up larger projects, we are finding more that cross international boundaries. Due to the way SQL handles date fields and how the CRM import process works, this presents some problems. Here is the summary of my findings on these issues.
Server time – this is the timezone of the server. So if you server is installed in NZ, you will be in GMT+12
User time – this is set in the user’s CRM options
Daylight saving – note that to make this email simpler, I have ignored daylight saving. When you are working out time adjustments, you will need add time on appropriately. Daylight saving varies by country and even within countries e.g. Queensland does not have it but NSW in the same timezone does.
1. Populating a date and time field through the UI
Date and time is entered as user’s local time and stored as UTC in the database. When viewed by a user, this is converted to the user’s time zone. This means that if you are an NZ user (GMT+12) and you add an appointment for 1100 NZ time, it will appear as 0900 NZ time to a user in the Sydney timezone (GMT+10). So far, so good.
Resolution: No required, working as expected
2. Populating a date only field through the UI
SQL does not have the concept of a date only and has to store date and time for date only record entered in CRM. It does this by storing the date at midnight local time. This means that if a NZ user (GMT+12) adds a date of 09/02/2011, it will be stored in SQL as 2011-02-08 12:00:00 (midday the day before) so that when you add on the 12 hours, it becomes 2011-02-09 00:00:00. Now, if this date is viewed by someone in the Sydney timezone (GMT+10), it will be converted to their local time by adding on 10 hours to give 2011-02-08 22:00:00 which when you display as a date only field shows as 08/02/2011 – the day before the date entered. In summary:
Date Entered by First User (dd/mm/yy) Time Zone of First User (GMT+no.of hours) Date and Time Stored in SQL Time Zone of Second User (GMT+no.of hours) Date and Time as Converted from SQL time Date Displayed in CRM for Second User
09/02/2011 12 08/02/2011 12:00:00 10 08/02/2011 22:00:00 08/02/2011
Therefore, whenever your timezone is ahead of someone else’s, the date only field when viewed by the other user will always display the previous day (as any number of hours subtracted off of midnight will always be the previous day). This will only be a problem where dates entered in one time zone need to be viewed in another. For example, if an admin in NZ adds Christmas Day to all calendars, it will be on 25 December in NZ and 24 December for everyone else. Note that anyone whose time zone is ahead of yours will always have the correct day (as you will never have to add on more than 24 hours).
Resolution: If the data can be entered locally then you will not experience this issue. If the data must be entered from another time zone, then you will need a plugin on the record to convert the date and time to equivalent of 11pm NZ time (see 4 below for why we use 11pm). Note that the user will never see the time component as this field is displayed as date only in CRM.
3. Populating a data and time field using data import
When importing data, CRM uses the zone of the user importing the data.
Resolution: The simplest fix is to change the timezone of the user importing the records and limiting the records to a single timezone. If you need to add multiple records across time zones in one load (e.g. when loading appointment data for all of Australia), you will need to convert the time to as it would appear in the loading user’s local time. For example, if you are a NZ user (GMT+10) and want to load an appointment for a Sydney user (GMT+10) to show in their calendar from 1000 to 1100, you will need to import it as 1300 to 1400 (the GMT+12 equivalent time). See 4 below if you want to know how to add or subtract hours from a field in Excel.
4. Populating a date only field using data import
If your user is in NZ and you are loading data for any other timezone than it will display the previous day (same logic as 2 above). If, for example, you are loading sales records for Australia which use a date-only transaction date to your NZ based server, then when these records are viewed by an Australian user, they will show a day earlier. The same problem will exist when you run reports – transactions listed on the 1st of a month will get moved to the previous month – which will mean all your figures are slightly out.
Resolution: If a field is configured as date only in CRM, you can still load a time component to this field. For New Zealand, you should add 23 hours so that no matter how many hours you are behind NZ, a date only field will always show the same date (even when adjusted for Daylight Saving although this is not included below).
Hawaii US West Coast (e.g. Redmond) US East Coast (e.g. New York) London Hong Kong Sydney NZ
GMT-9 GMT-8 GMT-5 GMT+0 GMT+8 GMT+10 GMT+12
2:00 3:00 6:00 11:00 19:00 21:00 23:00
Incidentally, If anyone needs me to fly out to Hawaii to rectify time zone issues, I’ll make myself available
To convert a date field in Excel, first format it to a custom formatting of ”dd/mm/yyyy hh:mm:ss”, then use the formula “=[Date Field] + Time (23,0,0)” where [Date Field] is the reference to the field to which you want to add time. A date that started out as 09/02/2011 will then end up as 09/02/2011 11:00:00 p.m. If you are saving your data as a CSV file, you must ensure the formatting is
Note that if you are in any other timezone, the no of hours to add is the number of hours you are ahead of the international date line minus 1
===============
Hi B,
Thanks for a great summary of the date headaches and possible solutions.
Given the problems with them I’m struggling to think of a reason why you would want to design a globalised system to record a date only and not the date and time.
Say that I am a resource NZ and I’m celebrating Christmas then someone in UK will want to know that I’m not available (a.k.a drunk) between midday of the 24rd until midday 25th UK time, not that it is Christmas day on that day. Also if someone in the UK wanted to send me a birthday wishes email they would need to be reminded to send it the day before to reach me in NZ on my Birthday.
Similarly for a deadline, if a task needs to be completed by Wednesday and the task creator is in NZ, then from their perspective the task should be completed by COB Wednesday NZ time regardless of where the task is being carried out. So while is tempting to make the due date Wednesday the task should have a due date-time of Wednesday at 5.30pm in NZ and Wednesday 3.30pm in the Oz. It is tempting to
Also if I understand you solution of adding 11 hours correctly, it will only work for countries that are further east on the globe than GMT + 2, fine for Oz but not ok for the west of this line UK, USA etc.
Cheers
A
=================
Hi A,
I agree that specific tasks which need completed at a specific time should always be date and time.
With the Christmas Day example, to mark this in everyone’s calendar correctly, you would need to create one entry for every timezone called NZ Christmas, NSW Christmas, Queensland Christmas, SA/NT Christmas, WA Christmas etc and you would either need to convert all times to NZ equivalent time or change your timezone before creating each of these if adding them as date only.
The problems occur when you have a global system which is administered and maintained out of one country (and NZ is the worst case scenario). For example, we have to load sales data with a date only field (customer does not have sales time, only date and has no interest in seeing a time field) for all global markets from NZ. These have to be manipulated to show on the correct date for the timezone.
You don’t add on 11 hours, you add on 23 hours, to make it 11pm as per my example below.
Kind regards,
B
Source - Intergen
Server time – this is the timezone of the server. So if you server is installed in NZ, you will be in GMT+12
User time – this is set in the user’s CRM options
Daylight saving – note that to make this email simpler, I have ignored daylight saving. When you are working out time adjustments, you will need add time on appropriately. Daylight saving varies by country and even within countries e.g. Queensland does not have it but NSW in the same timezone does.
1. Populating a date and time field through the UI
Date and time is entered as user’s local time and stored as UTC in the database. When viewed by a user, this is converted to the user’s time zone. This means that if you are an NZ user (GMT+12) and you add an appointment for 1100 NZ time, it will appear as 0900 NZ time to a user in the Sydney timezone (GMT+10). So far, so good.
Resolution: No required, working as expected
2. Populating a date only field through the UI
SQL does not have the concept of a date only and has to store date and time for date only record entered in CRM. It does this by storing the date at midnight local time. This means that if a NZ user (GMT+12) adds a date of 09/02/2011, it will be stored in SQL as 2011-02-08 12:00:00 (midday the day before) so that when you add on the 12 hours, it becomes 2011-02-09 00:00:00. Now, if this date is viewed by someone in the Sydney timezone (GMT+10), it will be converted to their local time by adding on 10 hours to give 2011-02-08 22:00:00 which when you display as a date only field shows as 08/02/2011 – the day before the date entered. In summary:
Date Entered by First User (dd/mm/yy) Time Zone of First User (GMT+no.of hours) Date and Time Stored in SQL Time Zone of Second User (GMT+no.of hours) Date and Time as Converted from SQL time Date Displayed in CRM for Second User
09/02/2011 12 08/02/2011 12:00:00 10 08/02/2011 22:00:00 08/02/2011
Therefore, whenever your timezone is ahead of someone else’s, the date only field when viewed by the other user will always display the previous day (as any number of hours subtracted off of midnight will always be the previous day). This will only be a problem where dates entered in one time zone need to be viewed in another. For example, if an admin in NZ adds Christmas Day to all calendars, it will be on 25 December in NZ and 24 December for everyone else. Note that anyone whose time zone is ahead of yours will always have the correct day (as you will never have to add on more than 24 hours).
Resolution: If the data can be entered locally then you will not experience this issue. If the data must be entered from another time zone, then you will need a plugin on the record to convert the date and time to equivalent of 11pm NZ time (see 4 below for why we use 11pm). Note that the user will never see the time component as this field is displayed as date only in CRM.
3. Populating a data and time field using data import
When importing data, CRM uses the zone of the user importing the data.
Resolution: The simplest fix is to change the timezone of the user importing the records and limiting the records to a single timezone. If you need to add multiple records across time zones in one load (e.g. when loading appointment data for all of Australia), you will need to convert the time to as it would appear in the loading user’s local time. For example, if you are a NZ user (GMT+10) and want to load an appointment for a Sydney user (GMT+10) to show in their calendar from 1000 to 1100, you will need to import it as 1300 to 1400 (the GMT+12 equivalent time). See 4 below if you want to know how to add or subtract hours from a field in Excel.
4. Populating a date only field using data import
If your user is in NZ and you are loading data for any other timezone than it will display the previous day (same logic as 2 above). If, for example, you are loading sales records for Australia which use a date-only transaction date to your NZ based server, then when these records are viewed by an Australian user, they will show a day earlier. The same problem will exist when you run reports – transactions listed on the 1st of a month will get moved to the previous month – which will mean all your figures are slightly out.
Resolution: If a field is configured as date only in CRM, you can still load a time component to this field. For New Zealand, you should add 23 hours so that no matter how many hours you are behind NZ, a date only field will always show the same date (even when adjusted for Daylight Saving although this is not included below).
Hawaii US West Coast (e.g. Redmond) US East Coast (e.g. New York) London Hong Kong Sydney NZ
GMT-9 GMT-8 GMT-5 GMT+0 GMT+8 GMT+10 GMT+12
2:00 3:00 6:00 11:00 19:00 21:00 23:00
Incidentally, If anyone needs me to fly out to Hawaii to rectify time zone issues, I’ll make myself available
To convert a date field in Excel, first format it to a custom formatting of ”dd/mm/yyyy hh:mm:ss”, then use the formula “=[Date Field] + Time (23,0,0)” where [Date Field] is the reference to the field to which you want to add time. A date that started out as 09/02/2011 will then end up as 09/02/2011 11:00:00 p.m. If you are saving your data as a CSV file, you must ensure the formatting is
Note that if you are in any other timezone, the no of hours to add is the number of hours you are ahead of the international date line minus 1
===============
Hi B,
Thanks for a great summary of the date headaches and possible solutions.
Given the problems with them I’m struggling to think of a reason why you would want to design a globalised system to record a date only and not the date and time.
Say that I am a resource NZ and I’m celebrating Christmas then someone in UK will want to know that I’m not available (a.k.a drunk) between midday of the 24rd until midday 25th UK time, not that it is Christmas day on that day. Also if someone in the UK wanted to send me a birthday wishes email they would need to be reminded to send it the day before to reach me in NZ on my Birthday.
Similarly for a deadline, if a task needs to be completed by Wednesday and the task creator is in NZ, then from their perspective the task should be completed by COB Wednesday NZ time regardless of where the task is being carried out. So while is tempting to make the due date Wednesday the task should have a due date-time of Wednesday at 5.30pm in NZ and Wednesday 3.30pm in the Oz. It is tempting to
Also if I understand you solution of adding 11 hours correctly, it will only work for countries that are further east on the globe than GMT + 2, fine for Oz but not ok for the west of this line UK, USA etc.
Cheers
A
=================
Hi A,
I agree that specific tasks which need completed at a specific time should always be date and time.
With the Christmas Day example, to mark this in everyone’s calendar correctly, you would need to create one entry for every timezone called NZ Christmas, NSW Christmas, Queensland Christmas, SA/NT Christmas, WA Christmas etc and you would either need to convert all times to NZ equivalent time or change your timezone before creating each of these if adding them as date only.
The problems occur when you have a global system which is administered and maintained out of one country (and NZ is the worst case scenario). For example, we have to load sales data with a date only field (customer does not have sales time, only date and has no interest in seeing a time field) for all global markets from NZ. These have to be manipulated to show on the correct date for the timezone.
You don’t add on 11 hours, you add on 23 hours, to make it 11pm as per my example below.
Kind regards,
B
Source - Intergen
Wednesday, 8 February 2012
When to use workflow and when to use plugin
Use workflow when the business logic must be performed by people who are not developers.
Use workflow when you need the ability to allow user to start a business logic manually.
Use Plugin when the delay between when the event occurs and when the business logic runs is NOT acceptable.
Use workflow when you need the ability to allow user to start a business logic manually.
Use Plugin when the delay between when the event occurs and when the business logic runs is NOT acceptable.
Saturday, 4 February 2012
Crm 2011 Sdk helper code summary
ServerConnection class: Frequently used. This class can held information needed to help you connect to and authenticate with Dynamics CRM 2011 using the OrganizationServiceProxy and DiscoveryServiceProxy classes.
DeviceIdManager class: Sometimes used. This class registers a computing device with Windows Live ID. This class is only needed when authenticating with Dynamics Crm Online
SystemUserProvider class: Rarely used. The purpose of this class is to create users in AD and Dynamics Crm 2011
Enumeratoins for Options Sets: Often used. These enumerations can be generated from the CrmSvcUtil code generation tool.
--------The SDK description---------
ServerConnection class:
The ServerConnection class provides methods to obtain server, organization, and user logon information for any Microsoft Dynamics CRM deployment. This information is needed to connect to and authenticate with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online using the DiscoveryServiceProxy and OrganizationServiceProxy classes. The ServerConnection class is used by most samples that ship with the Microsoft Dynamics CRM 2011 SDK.
DeviceIdManager class:
The DeviceIdManager class registers a computing device with Windows Live ID, through the generation of a device ID and password, and optionally stores that information in an encrypted format on the local disk for later reuse. This functionality is required when authenticating with Microsoft Dynamics CRM Online. The device registration is stored in the %USERPROFILE%\LiveDeviceID folder on the computing device.
The primary class method to call from your code is LoadOrRegisterDevice. For an example of how the DeviceIdManager class is used, see the GetDeviceCredentials method in the Helper Code: ServerConnection Class topic.
A Windows Azure hosted application that must authenticate with Microsoft Dynamics CRM Online should either set the PersistToFile property of DeviceIdManager to false or call the two parameter LoadOrRegisterDevice method passing in the required device ID and password. In both cases, the DeviceIdManager will not attempt to persist the device ID and password to a file.
SystemUserProvider class:
The SystemUserProvider class demonstrates how to programmatically create additional users in Active Directory and Microsoft Dynamics CRM 2011.
Several SDK samples require additional (fictitious) system users to exist in Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, other than the logged on user, for the sample to perform its intended task. For Microsoft Dynamics CRM 2011, these samples use the SystemUserProvider class methods to create these additional required users. Since it currently is not possible to programmatically create a new Windows Live ID user, when running against a Microsoft Dynamics CRM Online server, the code just prints the required user information to the console. You can then manually add and invite those users if desired.
Enumeratoins for Options Sets:
The SDK download package includes an extension to the CrmSvcUtil code generation tool that you can use to generate enumerations for all option set values including global option sets, picklist, state, and status values. For more information, see Sample Extension to Generate Enumerations for Option Sets.
DeviceIdManager class: Sometimes used. This class registers a computing device with Windows Live ID. This class is only needed when authenticating with Dynamics Crm Online
SystemUserProvider class: Rarely used. The purpose of this class is to create users in AD and Dynamics Crm 2011
Enumeratoins for Options Sets: Often used. These enumerations can be generated from the CrmSvcUtil code generation tool.
--------The SDK description---------
ServerConnection class:
The ServerConnection class provides methods to obtain server, organization, and user logon information for any Microsoft Dynamics CRM deployment. This information is needed to connect to and authenticate with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online using the DiscoveryServiceProxy and OrganizationServiceProxy classes. The ServerConnection class is used by most samples that ship with the Microsoft Dynamics CRM 2011 SDK.
DeviceIdManager class:
The DeviceIdManager class registers a computing device with Windows Live ID, through the generation of a device ID and password, and optionally stores that information in an encrypted format on the local disk for later reuse. This functionality is required when authenticating with Microsoft Dynamics CRM Online. The device registration is stored in the %USERPROFILE%\LiveDeviceID folder on the computing device.
The primary class method to call from your code is LoadOrRegisterDevice. For an example of how the DeviceIdManager class is used, see the GetDeviceCredentials method in the Helper Code: ServerConnection Class topic.
A Windows Azure hosted application that must authenticate with Microsoft Dynamics CRM Online should either set the PersistToFile property of DeviceIdManager to false or call the two parameter LoadOrRegisterDevice method passing in the required device ID and password. In both cases, the DeviceIdManager will not attempt to persist the device ID and password to a file.
SystemUserProvider class:
The SystemUserProvider class demonstrates how to programmatically create additional users in Active Directory and Microsoft Dynamics CRM 2011.
Several SDK samples require additional (fictitious) system users to exist in Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, other than the logged on user, for the sample to perform its intended task. For Microsoft Dynamics CRM 2011, these samples use the SystemUserProvider class methods to create these additional required users. Since it currently is not possible to programmatically create a new Windows Live ID user, when running against a Microsoft Dynamics CRM Online server, the code just prints the required user information to the console. You can then manually add and invite those users if desired.
Enumeratoins for Options Sets:
The SDK download package includes an extension to the CrmSvcUtil code generation tool that you can use to generate enumerations for all option set values including global option sets, picklist, state, and status values. For more information, see Sample Extension to Generate Enumerations for Option Sets.
Create a Crm console app from scratch 2. A quick startup program
When writing an application that uses the Microsoft Dynamics CRM SDK, you typically need to perform the following steps to configure your application’s project.
In the project’s properties, set the target framework to .NET Framework 4.
Add the following .NET references to your project:
System.Data.Linq
System.Runtime.Serialization
System.Security
System.ServiceModel
System.DirectoryServices.AccountManagement
Add the required Microsoft Dynamics CRM SDK assembly references. At a minimum, add Microsoft.Crm.Sdk.Proxy and Microsoft.Xrm.Sdk. For a complete list of the assemblies included in the Microsoft Dynamics CRM SDK, see Assemblies Included in the Microsoft Dynamics CRM SDK.
In most cases, you need to install Windows Identity Foundation and add a reference to Microsoft.IdentityModel to your project.
Including the following namespaces
using System;
//using System.ServiceModel; // Maybe needed for more complex crm programs
using System.ServiceModel.Description;
using Microsoft.Xrm.Sdk.Client;
//using Microsoft.Crm.Sdk; // Maybe needed for more complex crm programs
using Microsoft.Crm.Sdk.Messages;
#Use the Sample and Helper Code
In the project’s properties, set the target framework to .NET Framework 4.
Add the following .NET references to your project:
System.Data.Linq
System.Runtime.Serialization
System.Security
System.ServiceModel
System.DirectoryServices.AccountManagement
Add the required Microsoft Dynamics CRM SDK assembly references. At a minimum, add Microsoft.Crm.Sdk.Proxy and Microsoft.Xrm.Sdk. For a complete list of the assemblies included in the Microsoft Dynamics CRM SDK, see Assemblies Included in the Microsoft Dynamics CRM SDK.
In most cases, you need to install Windows Identity Foundation and add a reference to Microsoft.IdentityModel to your project.
Including the following namespaces
using System;
//using System.ServiceModel; // Maybe needed for more complex crm programs
using System.ServiceModel.Description;
using Microsoft.Xrm.Sdk.Client;
//using Microsoft.Crm.Sdk; // Maybe needed for more complex crm programs
using Microsoft.Crm.Sdk.Messages;
using System; //using System.Collections.Generic; //using System.Text; //using System.ServiceModel; using System.ServiceModel.Description; using Microsoft.Xrm.Sdk.Client; //using Microsoft.Crm.Sdk; using Microsoft.Crm.Sdk.Messages; namespace CrmConsoleApplication2 { public class Program { private static ClientCredentials _clientCreds; private static OrganizationServiceProxy _serviceProxy; public static void Main(string[] args) { _clientCreds = new ClientCredentials(); _clientCreds.Windows.ClientCredential.UserName = "Administrator"; _clientCreds.Windows.ClientCredential.Password = "NotTheRealPassword"; _clientCreds.Windows.ClientCredential.Domain = "PLAYGROUND"; using (_serviceProxy = new OrganizationServiceProxy(new Uri("http://localhost:5555/CRM2011RTM/XRMServices/2011/Organization.svc") , null , _clientCreds , null)) { WhoAmIRequest request = new WhoAmIRequest(); WhoAmIResponse response = (WhoAmIResponse)_serviceProxy.Execute(request); Console.WriteLine("User {0} has just connected", response.UserId); } Console.ReadLine(); } } }
#Use the Sample and Helper Code
Thursday, 2 February 2012
Microsoft Dynamics CRM 2011 – Error When Browsing Discovery.svc Service
Reference
http://yellowduckguy.wordpress.com/2012/02/03/microsoft-dynamics-crm-2011-error-when-browsing-discovery-svc-service/
Today I had to resolve a customer issue where the Dynamics CRM 2011 for Outlook Configuration Wizard could not find the CRM 2011 server and the CRM server did exist on the domain.
I was connecting Microsoft Outlook 2007 to CRM 2011 via the installed add-in Microsoft Dynamics CRM 2011 for Outlook.
My list of areas to troubleshoot this issue was as follows:
•Check CRM 2011 server is running ok. Can I browse it from the CRM Server?
•Check I can ping the CRM server from the Outlook client PC
•Check I can browse to CRM from the web browser on the Outlook client PC
•Check I can resolve the Discovery.svc service. CRM for Outlook Configuration tool uses this.
•Check the registry settings for the Configuration settings of CRM for Outlook
The Issue
Going through this list I found I could not resolve the Discovery.svc service from the Outlook client PC. You should be able to resolve the Discovery.svc service using the following URL. http://[yourcrmserver]/XRMServices/2011/Discovery.svc You should see a page similar to below when you can successfully render the Discovery Service.
So I thought I had a possible IIS issue as I couldn’t render the service on the CRM server as well. I decided to check the Event Viewer first for any clues. Below is the error message I received.
WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/63835064
Exception: System.ServiceModel.ServiceActivationException: The service ‘/XRMServices/2011/Discovery.svc’ cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting ‘system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled’ to true or specifying ‘system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters’.
Parameter name: item. —> System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting ‘system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled’ to true or specifying ‘system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters’.
Parameter name: item
at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at Microsoft.Crm.Sdk.V5.DiscoveryServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
— End of inner exception stack trace —
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
Process Name: w3wp
Process ID: 4116
From this error message it seems their is a http bindings issue within IIS. Then it came to me! One of our infrastructure guys had created another port binding for CRM to be on port 80 for some other unrelated testing.
Resolution
Therefore to resolve this I had to remove the extra http binding in the Microsoft Dynamics CRM website within IIS. To change or investigate your site bindings, click on
Bindings…
under
Edit Site
in IIS as shown below.
You should only have one http binding in the list as shown below. Note: I have removed the binding which was causing the problem in the image below.
Its possible to have multiple http bindings, but you will need to change some web.config values which contain
multipleSiteBindingsEnabled
and set it to
true
. See the error message earlier for more information. Hope that helps! Greg Olsen
http://yellowduckguy.wordpress.com/2012/02/03/microsoft-dynamics-crm-2011-error-when-browsing-discovery-svc-service/
Today I had to resolve a customer issue where the Dynamics CRM 2011 for Outlook Configuration Wizard could not find the CRM 2011 server and the CRM server did exist on the domain.
I was connecting Microsoft Outlook 2007 to CRM 2011 via the installed add-in Microsoft Dynamics CRM 2011 for Outlook.
My list of areas to troubleshoot this issue was as follows:
•Check CRM 2011 server is running ok. Can I browse it from the CRM Server?
•Check I can ping the CRM server from the Outlook client PC
•Check I can browse to CRM from the web browser on the Outlook client PC
•Check I can resolve the Discovery.svc service. CRM for Outlook Configuration tool uses this.
•Check the registry settings for the Configuration settings of CRM for Outlook
The Issue
Going through this list I found I could not resolve the Discovery.svc service from the Outlook client PC. You should be able to resolve the Discovery.svc service using the following URL. http://[yourcrmserver]/XRMServices/2011/Discovery.svc You should see a page similar to below when you can successfully render the Discovery Service.
So I thought I had a possible IIS issue as I couldn’t render the service on the CRM server as well. I decided to check the Event Viewer first for any clues. Below is the error message I received.
WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/63835064
Exception: System.ServiceModel.ServiceActivationException: The service ‘/XRMServices/2011/Discovery.svc’ cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting ‘system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled’ to true or specifying ‘system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters’.
Parameter name: item. —> System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting ‘system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled’ to true or specifying ‘system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters’.
Parameter name: item
at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at Microsoft.Crm.Sdk.V5.DiscoveryServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
— End of inner exception stack trace —
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
Process Name: w3wp
Process ID: 4116
From this error message it seems their is a http bindings issue within IIS. Then it came to me! One of our infrastructure guys had created another port binding for CRM to be on port 80 for some other unrelated testing.
Resolution
Therefore to resolve this I had to remove the extra http binding in the Microsoft Dynamics CRM website within IIS. To change or investigate your site bindings, click on
Bindings…
under
Edit Site
in IIS as shown below.
You should only have one http binding in the list as shown below. Note: I have removed the binding which was causing the problem in the image below.
Its possible to have multiple http bindings, but you will need to change some web.config values which contain
multipleSiteBindingsEnabled
and set it to
true
. See the error message earlier for more information. Hope that helps! Greg Olsen
Tuesday, 31 January 2012
Crm 2011 UI Terminology. Application and Entity form screen regions
Increase the Maximum Records exported to Excel
There are two ways to achieve it.
Method 1: Use Dynamic Excel spreadsheet
1) Select the view list you want to export. For example: Active Contacts.
2) Click Excel from the list toolbar and select Dynamic Worksheet option
3) Open the excel workbook and enable Data Connection if required
4) On the excel workbook, right click the data area, select Edit Query
5) If there is a pop-up windows about "The query cannot be edited by the Query Wizard", click ok. Now you will see the Microsoft Query window.
6) From the Microsoft Query toolbar, click View and select SQL. A new pop-up Windows showing the actual SQL statement appears.
7) Remove Top 10000 from the SQL statement and click OK to exit the SQL statement window
8) From the Microsoft Query window toolbar, click File and select Return Data to Microsoft Office Excel
9) Refresh your excel worksheet if auto-refresh is not enabled and you should see all data from the select CRM view now
Ref: http://usingmscrm.blogspot.co.nz/2009/09/export-to-excel-only-showing-10-000.html
Method 2: Change settings in CRM SQL Database
Follow the steps below to make the change at the database level in CRM 4.0. Maybe CRM 2011 as well.
Open SQL Mangement Studio
Use the_MSCRM database
Open the OrganizationBase table
Locate the column – MaxRecordsForExportToExcel
Change the value to the new value
Ref: http://www.powerobjects.com/blog/2010/03/29/increase-the-maximum-records-exported-to-excel/
http://support.microsoft.com/kb/911395
Credit to Elaiza Benitez
Method 1: Use Dynamic Excel spreadsheet
1) Select the view list you want to export. For example: Active Contacts.
2) Click Excel from the list toolbar and select Dynamic Worksheet option
3) Open the excel workbook and enable Data Connection if required
4) On the excel workbook, right click the data area, select Edit Query
5) If there is a pop-up windows about "The query cannot be edited by the Query Wizard", click ok. Now you will see the Microsoft Query window.
6) From the Microsoft Query toolbar, click View and select SQL. A new pop-up Windows showing the actual SQL statement appears.
7) Remove Top 10000 from the SQL statement and click OK to exit the SQL statement window
8) From the Microsoft Query window toolbar, click File and select Return Data to Microsoft Office Excel
9) Refresh your excel worksheet if auto-refresh is not enabled and you should see all data from the select CRM view now
Ref: http://usingmscrm.blogspot.co.nz/2009/09/export-to-excel-only-showing-10-000.html
Method 2: Change settings in CRM SQL Database
Follow the steps below to make the change at the database level in CRM 4.0. Maybe CRM 2011 as well.
Open SQL Mangement Studio
Use the
Open the OrganizationBase table
Locate the column – MaxRecordsForExportToExcel
Change the value to the new value
Ref: http://www.powerobjects.com/blog/2010/03/29/increase-the-maximum-records-exported-to-excel/
http://support.microsoft.com/kb/911395
Credit to Elaiza Benitez
When you export plugin, you need to export plugin's steps too.
When you export plugin, you need to export plugin's steps too. The steps are called Sdk Message Processing Steps.
Plugin Deployment in CRM 2011 - Best Practices
http://crmdm.blogspot.co.nz/2011/03/plugin-deployment-in-crm-2011-best.html
Plugin Deployment in CRM 2011 - Best Practices
http://crmdm.blogspot.co.nz/2011/03/plugin-deployment-in-crm-2011-best.html
Monday, 30 January 2012
Microsoft Dynamics CRM: Workflow Authoring Best Practices
The Microsoft Dynamics CRM workflow engine provides powerful functionality for implementing custom business logic in a CRM deployment. However, it also lends itself to complex problems and design mistakes which can result in expensive maintenance and confused users. This article explains in detail a few important considerations when implementing workflows and custom workflow activities in CRM.
1. Composition with child workflows.
The workflow pattern is in general one of composition of smaller steps. Therefore, when creating a workflow, think about which parts of the workflow can be generalized as a "sub-process" and be reused in multiple workflow definitions. By isolating these smaller processes, one can define child workflows which can then be called from multiple workflow definitions. The advantage is that the child workflow can be easily modified as opposed to modifying multiple workflow definitions. It will also make it simpler to define future workflows that might be a composition of smaller processes or business logic. One important consideration is that child workflows are executed asynchronously with respect to the parent workflow. Therefore, you should not make use of child workflows for sub-processes which require sequential execution.
2. Awareness of persistence points in workflow definitions.
If you have a long workflow that might take a long time to execute you will need to consider whether the workflow will persist and what that implies. A workflow can be persisted because of multiple reasons: The workflow instance is waiting for some event to occur, the CrmAsyncService is stopped or the workflow instance explicitly requests to be persisted by executing an activity with the PersistOnCloseAttribute. In any case, the workflow engine unloads the workflow instance and persists it to the database until a user manually resumes the workflow or an event occurs which resumes the workflow automatically. The important considerations are
1) At what point does the workflow persist? The workflow will persist up to the step when the last activity is marked as a persistence point. Therefore, when it resumes, it will re-execute all the steps after the last persistence point. This is important if you have logic in your workflow which you want to guarantee does not execute more than once. Note that workflow instances are automatically persisted after the following CRM steps: create, update, send email, send email from template, assign, change status, child workflow and stage. For custom activities you can add [PersistOnClose] attribute to the activity class. (see http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.persistoncloseattribute.aspx).
2) When is the workflow going to resume? If the workflow will wait on an event that might never happen or take years to occur, then the database will soon contain thousands of waiting workflows which could affect performance. You should consider a design in which this situation is minimized. For example a workflow that waits on an opportunity to be marked as “won” can wait forever and the condition never meets. Instead wait on the opportunity to be closed and then check the status reason once it is marked as closed; if it was not marked as “won” you might want to add a Stop Workflow step at that point.
3. Write "atomic" custom activities.
Custom workflow activities should not implement the entire logic of the workflow, they are ideally small "atomic" steps that will make part of larger workflows. Because custom activities don't have the ability to control persistence, they should never cause the workflow to go idle or persist in the middle of a custom activity. Generally, it is better to have multiple custom activities that are called in sequence from a parent workflow than one large custom activity that implements all the logic in sequence. This also follows from the principle of workflow as a composition pattern. For example if your process is to take custom actions A, B and C when an account is opened, it is generally better to write a custom activity for each A, B and C separately and add a step for each activity in your workflow as opposed to writing a custom activity that implements A, B and C sequentially and then add a single step to the workflow to include this custom activity.
4. Correct use of "Execution Time".
The CRM workflow designer provides a property called "Execution Time" which can be used in dynamic expressions such as "if Account(CreatedOn) + 10 days < workflow(ExecutionTime)". The meaning of this property is neither the time at which the workflow is published nor the time the workflow instance starts. The actual value of this property is the real time when the workflow evaluates an expression that contains this property. Therefore, expressions such as "Wait until 1 day after workflow(ExecutionTime)" will never succeed and the workflow will wait and resume once a day forever causing performance problems. If you want your workflow to wait for a specific amount of time you should use the wait step and configure the condition as: workflow – timeout – equals – {Duation}. This will unload the workflow and resume execution after the specified time duration has passed. 5. Plugins Vs. Workflows. This is a common dilemma in CRM and there is no exact formula to find the best implementation method for a specific situation. However, this article provides some general rules of thumb that can be used to decide whether to use a plugin or a workflow: http://blogs.msdn.com/lezamax/archive/2008/04/02/plug-in-or-workflow.aspx Ref: http://blogs.msdn.com/b/crm/archive/2010/01/15/microsoft-dynamics-crm-workflow-authoring-best-practices.aspx
1. Composition with child workflows.
The workflow pattern is in general one of composition of smaller steps. Therefore, when creating a workflow, think about which parts of the workflow can be generalized as a "sub-process" and be reused in multiple workflow definitions. By isolating these smaller processes, one can define child workflows which can then be called from multiple workflow definitions. The advantage is that the child workflow can be easily modified as opposed to modifying multiple workflow definitions. It will also make it simpler to define future workflows that might be a composition of smaller processes or business logic. One important consideration is that child workflows are executed asynchronously with respect to the parent workflow. Therefore, you should not make use of child workflows for sub-processes which require sequential execution.
2. Awareness of persistence points in workflow definitions.
If you have a long workflow that might take a long time to execute you will need to consider whether the workflow will persist and what that implies. A workflow can be persisted because of multiple reasons: The workflow instance is waiting for some event to occur, the CrmAsyncService is stopped or the workflow instance explicitly requests to be persisted by executing an activity with the PersistOnCloseAttribute. In any case, the workflow engine unloads the workflow instance and persists it to the database until a user manually resumes the workflow or an event occurs which resumes the workflow automatically. The important considerations are
1) At what point does the workflow persist? The workflow will persist up to the step when the last activity is marked as a persistence point. Therefore, when it resumes, it will re-execute all the steps after the last persistence point. This is important if you have logic in your workflow which you want to guarantee does not execute more than once. Note that workflow instances are automatically persisted after the following CRM steps: create, update, send email, send email from template, assign, change status, child workflow and stage. For custom activities you can add [PersistOnClose] attribute to the activity class. (see http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.persistoncloseattribute.aspx).
2) When is the workflow going to resume? If the workflow will wait on an event that might never happen or take years to occur, then the database will soon contain thousands of waiting workflows which could affect performance. You should consider a design in which this situation is minimized. For example a workflow that waits on an opportunity to be marked as “won” can wait forever and the condition never meets. Instead wait on the opportunity to be closed and then check the status reason once it is marked as closed; if it was not marked as “won” you might want to add a Stop Workflow step at that point.
3. Write "atomic" custom activities.
Custom workflow activities should not implement the entire logic of the workflow, they are ideally small "atomic" steps that will make part of larger workflows. Because custom activities don't have the ability to control persistence, they should never cause the workflow to go idle or persist in the middle of a custom activity. Generally, it is better to have multiple custom activities that are called in sequence from a parent workflow than one large custom activity that implements all the logic in sequence. This also follows from the principle of workflow as a composition pattern. For example if your process is to take custom actions A, B and C when an account is opened, it is generally better to write a custom activity for each A, B and C separately and add a step for each activity in your workflow as opposed to writing a custom activity that implements A, B and C sequentially and then add a single step to the workflow to include this custom activity.
4. Correct use of "Execution Time".
The CRM workflow designer provides a property called "Execution Time" which can be used in dynamic expressions such as "if Account(CreatedOn) + 10 days < workflow(ExecutionTime)". The meaning of this property is neither the time at which the workflow is published nor the time the workflow instance starts. The actual value of this property is the real time when the workflow evaluates an expression that contains this property. Therefore, expressions such as "Wait until 1 day after workflow(ExecutionTime)" will never succeed and the workflow will wait and resume once a day forever causing performance problems. If you want your workflow to wait for a specific amount of time you should use the wait step and configure the condition as: workflow – timeout – equals – {Duation}. This will unload the workflow and resume execution after the specified time duration has passed. 5. Plugins Vs. Workflows. This is a common dilemma in CRM and there is no exact formula to find the best implementation method for a specific situation. However, this article provides some general rules of thumb that can be used to decide whether to use a plugin or a workflow: http://blogs.msdn.com/lezamax/archive/2008/04/02/plug-in-or-workflow.aspx Ref: http://blogs.msdn.com/b/crm/archive/2010/01/15/microsoft-dynamics-crm-workflow-authoring-best-practices.aspx
Correct use of "Execution Time"
The CRM workflow designer provides a property called "Execution Time" which can be used in dynamic expressions such as "if Account(CreatedOn) + 10 days < workflow(ExecutionTime)". The meaning of this property is neither the time at which the workflow is published nor the time the workflow instance starts. The actual value of this property is the real time when the workflow evaluates an expression that contains this property. Therefore, expressions such as "Wait until 1 day after workflow(ExecutionTime)" will never succeed and the workflow will wait and resume once a day forever causing performance problems. If you want your workflow to wait for a specific amount of time you should use the wait step and configure the condition as: workflow – timeout – equals – {Duation}. This will unload the workflow and resume execution after the specified time duration has passed.
Reference
http://blogs.msdn.com/b/crm/archive/2010/01/15/microsoft-dynamics-crm-workflow-authoring-best-practices.aspx
Reference
http://blogs.msdn.com/b/crm/archive/2010/01/15/microsoft-dynamics-crm-workflow-authoring-best-practices.aspx
Sunday, 29 January 2012
Create a Crm console app from scratch.
*Set the project's Target framework to be .Net Framework 4.
*To interact with Crm 2011 API, you can either refer to CRM 2011 sdk binary files or Service Reference
+ If you want to use sdk binary files: Include the
Microsoft.Crm.Sdk.Proxy.dll
Microsoft.Xrm.Sdk.dll in project reference
System.Security
System.Runtime.Serialization
and System.ServiceModel (This is for using WCF)
+ If you want to use Service Reference: Download the Organization Service endpoint from the Crm Developer Resources page.
*Reference the namespaces in the code.
using System.ServiceModel; // For using the WCF
using System.ServiceModel.Description; // You need this to use the ClientCredential class.
//Contains enumerations of possible picklists and integer values for some attributes.
//The naming convention of the classes is to make it easier to locate the specific attribute.
using Microsoft.Crm.Sdk;
//Defines the data contracts for attribute types, interfaces for authoring plug-ins,
//and other general purpose xRM types and methods.
using Microsoft.Xrm.Sdk;
//Defines classes for use by client-code, including a data context,
//proxy classes to ease the connection to Microsoft Dynamics CRM, and the LINQ provider.
using Microsoft.Xrm.Sdk.Client;
// Defines request/response classes for Create, Retrieve, Update, Delete, Associate , Disassociate, and the metadata classes.
using Microsoft.Xrm.Sdk.Messages;
// Defines query classes required to connect to Microsoft Dynamics CRM.
using Microsoft.Xrm.Sdk.Query;
Microsoft.Crm.Sdk.Messages;
The namespaces required for doing a WhoAmIRequest are Microsoft.Crm.Sdk, Microsoft.Xrm.Sdk.Client, Microsoft.Crm.Sdk.Messages, System.ServiceModel, System.ServiceModel.Description.
* Include the deviceidmanager.cs file in the project for authentication. Your can find the class in the crm sdk helper folder \\SDK CRM 2011\sdk\samplecode\cs\helpercode\deviceidmanager.cs.
+ Also include the Microsoft.Crm.Services.Utility namespace.
* Setup the credential which will be used to connect to Crm WCF endpoint
* Connect to WCF endpoint
* Require early bound type support
* Do something with theh endpoint
*To interact with Crm 2011 API, you can either refer to CRM 2011 sdk binary files or Service Reference
+ If you want to use sdk binary files: Include the
Microsoft.Crm.Sdk.Proxy.dll
Microsoft.Xrm.Sdk.dll in project reference
System.Security
System.Runtime.Serialization
and System.ServiceModel (This is for using WCF)
+ If you want to use Service Reference: Download the Organization Service endpoint from the Crm Developer Resources page.
*Reference the namespaces in the code.
using System.ServiceModel; // For using the WCF
using System.ServiceModel.Description; // You need this to use the ClientCredential class.
//Contains enumerations of possible picklists and integer values for some attributes.
//The naming convention of the classes is
using Microsoft.Crm.Sdk;
//Defines the data contracts for attribute types, interfaces for authoring plug-ins,
//and other general purpose xRM types and methods.
using Microsoft.Xrm.Sdk;
//Defines classes for use by client-code, including a data context,
//proxy classes to ease the connection to Microsoft Dynamics CRM, and the LINQ provider.
using Microsoft.Xrm.Sdk.Client;
// Defines request/response classes for Create, Retrieve, Update, Delete, Associate , Disassociate, and the metadata classes.
using Microsoft.Xrm.Sdk.Messages;
// Defines query classes required to connect to Microsoft Dynamics CRM.
using Microsoft.Xrm.Sdk.Query;
Microsoft.Crm.Sdk.Messages;
The namespaces required for doing a WhoAmIRequest are Microsoft.Crm.Sdk, Microsoft.Xrm.Sdk.Client, Microsoft.Crm.Sdk.Messages, System.ServiceModel, System.ServiceModel.Description.
* Include the deviceidmanager.cs file in the project for authentication. Your can find the class in the crm sdk helper folder \\SDK CRM 2011\sdk\samplecode\cs\helpercode\deviceidmanager.cs.
+ Also include the Microsoft.Crm.Services.Utility namespace.
* Setup the credential which will be used to connect to Crm WCF endpoint
* Connect to WCF endpoint
* Require early bound type support
* Do something with theh endpoint
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ServiceModel; // For using the WCF using System.ServiceModel.Description; // Contains enumerations of possible picklists and integer values for some attributes. // The naming convention of the classes is [open arrow brace]entityname[close arrow brace][open arrow brace]attributename[close arrow brace] to make it easier to locate the specific attribute. using Microsoft.Crm.Sdk; // Defines the data contracts for attribute types, interfaces for authoring plug-ins, // and other general purpose xRM types and methods. //using Microsoft.Xrm.Sdk; // Defines classes for use by client-code, including a data context, // proxy classes to ease the connection to Microsoft Dynamics CRM, and the LINQ provider. using Microsoft.Xrm.Sdk.Client; // Defines request/response classes for Create, Retrieve, Update, Delete, Associate , Disassociate, and the metadata classes. //using Microsoft.Xrm.Sdk.Messages; // Defines query classes required to connect to Microsoft Dynamics CRM. //using Microsoft.Xrm.Sdk.Query; using Microsoft.Crm.Services.Utility; using Microsoft.Crm.Sdk.Messages; namespace CrmConsoleApplication1 { class Program { private static OrganizationServiceProxy _serviceProxy; private static ClientCredentials _clientCreds; //private static ClientCredentials _deviceCreds; static void Main(string[] args) { // Setup credential _clientCreds = new ClientCredentials(); _clientCreds.Windows.ClientCredential.UserName = "Administrator"; _clientCreds.Windows.ClientCredential.Password = "NotTheRealPassword"; _clientCreds.Windows.ClientCredential.Domain = "PLAYGROUND"; // The DeviceIdManager class registers a computing device with Windows Live ID, through the generation of a device ID and password, // and optionally stores that information in an encrypted format on the local disk for later reuse. // This will fail here as this vm don't have access to the Internet therefore there is no way for it to generate a device ID with login.live.com //_deviceCreds = DeviceIdManager.LoadOrRegisterDevice(); // Connect to Crm WCF endpoint using (_serviceProxy = new OrganizationServiceProxy(new Uri("http://localhost:5555/CRM2011RTM/XRMServices/2011/Organization.svc"), null, _clientCreds, null)) { // require early bound type support _serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); OrganizationServiceContext orgContext = new OrganizationServiceContext(_serviceProxy); WhoAmIRequest request = new WhoAmIRequest(); WhoAmIResponse response = (WhoAmIResponse)orgContext.Execute(request); Console.WriteLine("Your Crm user Guid is {0}", response.UserId); } Console.Read(); } } }
Saturday, 28 January 2012
CRM 2011: IntelliSense for Xrm.Page
http://www.patrickverbeeten.com/pages/ContentItemPage.aspx?id=31&item=118&p=true
In CRM 2011 Javascript is no longer embedded in forms but now has build in feature to use external resource files. You can edit these files using the web browser or in an external editor. Visual studio supports Intellisense for JavaScript, this explains how enable the support for the CRM provided objects such as the Xrm.Page object to be shown.
To enable this support Visual Studio needs a reference to base the IntelliSense. First you need to download the reference file XrmPage-vsdoc.js (right click and choose save). Save this file on a convinient location. Now you can create a new js file in Visual Studio then add the following line to the top of this file:
///
The path to the file can either be relative or absolute, in this example the reference file is placed in a folder named IntelliSense in the folder where the new web resource js file is saved.
I have only tried this file with Visual Studio 2010. If there are any function which are incorrect or other errors please let me know.
This file is distributed as Freeware for details see here or the license contained in the file.
On this site http://crm2011snippets.codeplex.com you can download a set of snippets to automate common functions for JavaScript used with CRM.
In CRM 2011 Javascript is no longer embedded in forms but now has build in feature to use external resource files. You can edit these files using the web browser or in an external editor. Visual studio supports Intellisense for JavaScript, this explains how enable the support for the CRM provided objects such as the Xrm.Page object to be shown.
To enable this support Visual Studio needs a reference to base the IntelliSense. First you need to download the reference file XrmPage-vsdoc.js (right click and choose save). Save this file on a convinient location. Now you can create a new js file in Visual Studio then add the following line to the top of this file:
///
The path to the file can either be relative or absolute, in this example the reference file is placed in a folder named IntelliSense in the folder where the new web resource js file is saved.
I have only tried this file with Visual Studio 2010. If there are any function which are incorrect or other errors please let me know.
This file is distributed as Freeware for details see here or the license contained in the file.
On this site http://crm2011snippets.codeplex.com you can download a set of snippets to automate common functions for JavaScript used with CRM.
Thursday, 26 January 2012
ClickDimensions - Marketing addon for Crm.
I attended a ClickDimensions webinar today. They had a quite interesting product focus on marketing. Some highlights, you can use their product to create marketing email, web/portal forms, portal surveys. Their product can also track on who viewed your links in the email you sent and on your portal pages. The tracking is impressive and a bit scary. Their email template is definitely a step up from the out of box email template. Have a look at the links below.
However I think they are still lacking of features for facebook, twitter and other social tools.
Recorded and weekly webinars
http://www.clickdimensions.com/webinar/
How to Guides
http://www.clickdimensions.com/support/guides.asp
However I think they are still lacking of features for facebook, twitter and other social tools.
Recorded and weekly webinars
http://www.clickdimensions.com/webinar/
How to Guides
http://www.clickdimensions.com/support/guides.asp
Wednesday, 25 January 2012
How to change crm 2011 online session timeout?
(On the ADFS server?)Open a Windows PowerShell window with Administrative Rights.
PS > Add-PSSnapin Microsoft.Adfs.PowerShell
PS > Get-ADFSRelyingPartyTrust -Name:”relying_party“
PS > Set-ADFSRelyingPartyTrust -TargetName “your_relying_party_name” -TokenLifetime 7200
So this code set the session timeout as 12 Hours (7200 minutes )
Don’t forget to replace your_relying_party_name with the real name in your AD FS 2 Manager –>Relying Party Trusts
http://www.interactivewebs.com/blog/index.php/server-tips/your-session-in-microsoft-dynamics-crm-is-about-to-expire-crm-2011-extend-session-time/
http://www.isvlabs.com/2011/11/how-to-set-dynamics-crm-2011-ifd-session-timeout/
PS > Add-PSSnapin Microsoft.Adfs.PowerShell
PS > Get-ADFSRelyingPartyTrust -Name:”relying_party“
PS > Set-ADFSRelyingPartyTrust -TargetName “your_relying_party_name” -TokenLifetime 7200
So this code set the session timeout as 12 Hours (7200 minutes )
Don’t forget to replace your_relying_party_name with the real name in your AD FS 2 Manager –>Relying Party Trusts
http://www.interactivewebs.com/blog/index.php/server-tips/your-session-in-microsoft-dynamics-crm-is-about-to-expire-crm-2011-extend-session-time/
http://www.isvlabs.com/2011/11/how-to-set-dynamics-crm-2011-ifd-session-timeout/
Subscribe to:
Posts (Atom)