Get a list of all Business Rules from your CRM environment

Referencing to the original post on CRM 2013 from here.

As Business Rules are created for a particular entity, we can see all the business rules that have been created for any particular entity from the entity customization itself.

This is ok when we need to see all the business rules on an entity. But it does not allow us to pull up a list of business rules across the whole system. Sometimes after deploying a solution, we need to check the business rules to make sure they’re activated, or if there are any errors, and we don’t want to have to go through each entity and check these.

As Business Rules are workflows under the hood, we can do an Advanced Find query with filter criteria on Categories as Business Rule (for CRM 2013, it was PBL) to get the list of all business rules in an organization. The result contains Name, Primary Entity, status and other basic information about the business rule.

p1

p2

 

Advertisements

OnLoad event for SubGrid in CRM 2015 Update 1

Till CRM 2011 we used to use Xrm.page.getControl(“grid”) to get a grid control available on form and perform any runtime activity like changing the view/query, etc. Also we were required to write the complete script on OnLoad even of form and add a timeout till the subgrid is loaded as subgrids are loaded asynchronously after the form is loaded. There was no way we can have a trigger on load of a subgrid till CRM 2015 Update 1. What we used to do is explained in older post here.

But with CRM 2015 update 1, we now have an option to execute scripts when data is loaded in subgrids. Because of which we are not required to have any timeout added in the script and iterate it till the data is loaded into subgrid.

With addition on GridControl.addOnLoad method, we can now add event handler for OnLoad event of subgrid which is more reliable than the form OnLoad event for form with a timeout. This event will get triggered whenever data is bound to a subgrid.

The steps to add this event is not similar to adding a form OnLoad event (from form customization popup), the way to add it is by invoking it using a code from other events (e.g. form OnLoad) by making use of GridControl.addOnLoad method. Similarly, use GridControl.removeOnLoad to remove event handlers.

Xrm.Page.getControl(“Contacts”).addOnLoad(myContactsGridOnloadFunction);

References:

https://msdn.microsoft.com/en-us/library/dn932137.aspx?f=255&MSPPError=-2147217396

https://msdn.microsoft.com/en-us/library/dn932126.aspx#BKMK_subgridAddOnLoad

https://crmcooking.wordpress.com/2015/07/15/writing-scripts-for-subgrids-with-crm-2015-update-1/

Migrating data to a live on-premises CRM system?

While working on one of the project, we were required to move data from legacy system into a live production system with limited amount of black out window. One can calculate the time required based on number of records, server configuration, etc. and can even have a buffer. But you never know when Murphy will play his role.

Below are few points that, if considered can help Murphy stick to its seat and don’t show up. (Just some pre-checks that helps the processJ)

  • Confirm disk space on SQL, web and application server. Have some buffer space as logs will grow.
  • As your target system is a live production system, surly there will be some scheduled maintenance jobs running to maintain server health as part of disaster management. These jobs are life savers but problem with them is that these are scheduled in down time as they consume high resources. And unfortunately this is the only time when we can perform our import. Thus you may have to consider pausing the maintenance jobs. But do remember to turn them on once done with the import. Some of the resource consuming jobs are: consistency check, database backup, async-operation cleanup, POA, etc. Pausing this job helps the import utilize maximum available server resources.
  • Check the database log size and clear. The log will grow with the import and if it reaches the maximum available threshold the import processes throws timeout errors. Also check the shrink process, preferred if simple.
  • Check for CPU and Memory usage on SQL, web and application server.
  • Check for any blockage on SQL server, if any script is blocking or slow running queries.
  • Clear AsyncOperationBase table.
  • You may run into scenario where it is required to restart the SQL service. Make sure that this do not affect any other process. Also in case of NLB, upon restarting the SQL service switches the active node. Thus you will also have to consider that node for performance check.
  • You may have to disable the user logging and turn off the workflows and plugins.

And last but not the least is FULL database backup before start of the process. Also you make to do this in several passes due to amount of data and limited amount of down time. Identity the steps that can be performed outside black out that do not affect live system. This provides some extra time for completing the critical steps.

I would recommend to do the import in multiple small passes which helps in keeping the buffer and reduces the chances of breaking things or running on edges. After all “Rome was not built in a day”.

These are some of the steps that helped me. As always, these may not match exactly to your requirement but some of them will surly. And I don’t guaranty of anything from the steps as risk will be yours as it’s your production system.

If you have anything to add, please write in comment and I will update the content. Thanks!

{Rebloged} Managing Language Translations for multiple Organizations

A friend of mine recently posted an article on managing language translations where he discussed a way to import language translations to multiple CRM organizations using standard solution import process. I’m not fortunate yet to work on any multi language implementation thus is was good to know about.

http://crm.ipiyush.me/managing-language-translations-for-multiple-organizations/

Performance issue after upgrade to CRM 2015

While working on one upgrade project, after successfully completion of all activities there were multiple performance issues experienced. While we were trying to troubleshoot the issue, may be in wrong direction; found this great article today from Sudhir Nory which explains the root cause. This may not be the issue for all performance issue on upgrade projects but is surly helpful to know.

When a database is upgraded to SQL Server 2014 from any earlier version of SQL Server, the database retains its existing compatibility level if it is at least 100(SQL Server 2008 R2). If the compatibility-level setting is 110 or lower it uses the old query optimizer which may not be effective. We found the current compatibility level displayed in the Compatibility level list box was SQL server 2008 for the ORG_MSCRM Database SQL Server 2014 includes substantial improvements to the component that creates and optimized query plans and gets utilized only when database compatibility level is reset to 120 (SQL server 2014).

http://blogs.msdn.com/b/crminthefield/archive/2015/06/04/improve-crm-query-performance-using-compatibility-version-120-when-using-sql-2014.aspx

Background Processes not visible for Order form in CRM 2015

Recently while customizing the Order form for one of the customization, my team found this interesting thing w.r.t Background Processes (System Jobs) and Order form navigation. We were facing problem getting the link in navigation though I can see the relationship already added in customization mode but not in the ribbon. Not sure if this is a bug or something by design that I’m missing as same behavior was on new CRM online instance too. I have an open question for same on Community Forum here.

It seems like a bug, please consider voting for this issue in Microsoft connect.

https://connect.microsoft.com/dynamicssuggestions/feedbackdetail/view/1158496/order-form-navigation-link-issue-for-background-process-and-process-sessions