Monday, February 6, 2017

RDWeb - Cannot use Connect to a PC Functionality

After completing the setup of the RDS/RDWeb on Windows Server 2012 R2 we were unable to use the "Connect to a PC" functionality. When attempting to connect the following error:

Remote Desktop can't find the computer "". This means that "" does not belong to the specific network. Verify the computer name and domain that you are trying to connect to" 

The fix for this is to go into the IIS Manager on the RDS server. 
 -Go to Server -> Sites -> Default Web Site -> RDWeb -> Pages 
-Click on Application Settings. 
-Modify the DefaultTSGateway setting by entering the FQDN of your RDS server. eg(rds.richardawilson.lab)

Tuesday, October 18, 2016

Deleted Forms Cause Error in Publish

During recent CRM upgrades I started getting the following error on publish.
systemform With Id = {Guid} Does Not Exist
After looking through the database it was discovered that there were upgraded forms that had been marked with the component state of deleted which were causing the error. Deleting those rows marked with the component state of 2 (deleted) allowed for publishing.

*** Disclaimer: Modifying CRM data directly can void your warranty. Use at your own risk. ***
delete from systemformbase where componentstate = 2

Tuesday, October 4, 2016

Repost: Loading Assemblies from Anywhere into a New AppDomain by 2012 by Marius Bancila

If you are interested in loading assemblies into a worker domain which do not live in the base directory of that worker domain, check out this great article with code.

Friday, September 9, 2016

Watch Window Copy for Plugin Context Depth Issues

For those times when you are trying to figure out a plugin depth issue and you want to quickly copy/past into your watch window.


Thursday, August 4, 2016

Get Solutions Containing Web Resource

Snipit to determine which solutions contain a web resource.
  FROM [Default_MSCRM].[dbo].[SolutionComponentBase] SC
  LEFT JOIN Default_MSCRM.dbo.SolutionBase S ON S.SolutionId = SC.SolutionId
  INNER JOIN Default_MSCRM.dbo.WebResourceBase WR ON WR.WebResourceId = SC.ObjectId
  WHERE WR.Name LIKE '%classeventscoresheet.htm%'

Thursday, April 7, 2016

Refresh ISV/WebResource after CRM 2013/2015/2016 Save Event

I had a Web Resource page which needed to refresh a jqgrid on it after some fields on a CRM form were updated and record was saved. In order to do this a ran a watcher to check to see if the modified date of the record had changed if so I ran the code to update the grid. This code is on the actual Web Resource page not the form JS. Also a quick note you may want to run another watcher to make sure window.parent.Xrm.Page is not null before you run this code.
//set the initial modified on date
var prevModifedOn = window.parent.Xrm.Page.getAttribute('modifiedon').getValue();

var xrmPageWatcher = window.setInterval(function () {
    //check to see if the date is modified, convert to string since JS doesn't know how to convert the CRM date time to a datetime object
    if (window.parent.Xrm.Page.getAttribute('modifiedon').getValue().toString() != prevModifedOn.toString()) {
    //update the previous data time so we can detect another save
    prevModifedOn = window.parent.Xrm.Page.getAttribute('modifiedon').getValue();
    //refresh our JQ grid or do whatever else you want like refresh the whole web resource etc.
    $("#grid").jqGrid('setGridParam', { data: awardsDS.generateDataTable(true) }).trigger('reloadGrid');           
}, 500);   

Monday, December 7, 2015

SQL - Determine Locking

Gets the list of sessions which are blocking others in SQL
WITH [Blocking]
AS (SELECT w.[session_id]
 FROM [sys].[dm_os_waiting_tasks] w
 INNER JOIN [sys].[dm_exec_sessions] s ON w.[session_id] = s.[session_id]
 INNER JOIN [sys].[dm_exec_requests] r ON s.[session_id] = r.[session_id]
 CROSS APPLY [sys].[dm_exec_sql_text](r.[plan_handle]) q
 CROSS APPLY [sys].[dm_exec_query_plan](r.[plan_handle]) p
 WHERE w.[session_id] > 50
  AND w.[wait_type] NOT IN ('DBMIRROR_DBM_EVENT'
SELECT b.[session_id] AS [WaitingSessionID]
      ,b.[blocking_session_id] AS [BlockingSessionID]
      ,b.[login_name] AS [WaitingUserSessionLogin]
      ,s1.[login_name] AS [BlockingUserSessionLogin]
      ,b.[original_login_name] AS [WaitingUserConnectionLogin] 
      ,s1.[original_login_name] AS [BlockingSessionConnectionLogin]
      ,b.[wait_duration_ms] AS [WaitDuration]
      ,b.[wait_type] AS [WaitType]
      ,t.[request_mode] AS [WaitRequestMode]
      ,UPPER(b.[status]) AS [WaitingProcessStatus]
      ,UPPER(s1.[status]) AS [BlockingSessionStatus]
      ,b.[wait_resource] AS [WaitResource]
      ,t.[resource_type] AS [WaitResourceType]
      ,t.[resource_database_id] AS [WaitResourceDatabaseID]
      ,DB_NAME(t.[resource_database_id]) AS [WaitResourceDatabaseName]
      ,b.[resource_description] AS [WaitResourceDescription]
      ,b.[program_name] AS [WaitingSessionProgramName]
      ,s1.[program_name] AS [BlockingSessionProgramName]
      ,b.[host_name] AS [WaitingHost]
      ,s1.[host_name] AS [BlockingHost]
      ,b.[command] AS [WaitingCommandType]
      ,b.[text] AS [WaitingCommandText]
      ,b.[row_count] AS [WaitingCommandRowCount]
      ,b.[percent_complete] AS [WaitingCommandPercentComplete]
      ,b.[cpu_time] AS [WaitingCommandCPUTime]
      ,b.[total_elapsed_time] AS [WaitingCommandTotalElapsedTime]
      ,b.[reads] AS [WaitingCommandReads]
      ,b.[writes] AS [WaitingCommandWrites]
      ,b.[logical_reads] AS [WaitingCommandLogicalReads]
      ,b.[query_plan] AS [WaitingCommandQueryPlan]
      ,b.[plan_handle] AS [WaitingCommandPlanHandle]
FROM [Blocking] b
INNER JOIN [sys].[dm_exec_sessions] s1
ON b.[blocking_session_id] = s1.[session_id]
INNER JOIN [sys].[dm_tran_locks] t
ON t.[request_session_id] = b.[session_id]
WHERE t.[request_status] = 'WAIT'