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'

SQL Currently Running Sessions

Get all current sessions running on sql instance.
SELECT r.session_id, r.status, r.start_time, r.command, s.text, 
r.wait_time, r.cpu_time, r.total_elapsed_time, r.reads, r.writes, r.logical_reads, r.transaction_isolation_level 
FROM sys.dm_exec_requests r 
CROSS APPLY sys.dm_exec_sql_text(r.sql_handle) s

SQL - Get Connected Hosts

Gets a list of all the connections currently open on SQL
 FROM sys.dm_exec_requests DMER
INNER JOIN sys.dm_exec_sessions DMES ON DMES.session_id=DMER.session_id
INNER JOIN sys.dm_exec_connections DMEC ON DMEC.session_id=DMES.session_id

Tuesday, September 22, 2015

Online PDF Permissions Remover

Based upon the 20 or so PDF unlockers I have used this one has always worked the best for me.

Key Features of CrackMyPDF:
- Remove PDF restrictions for copying, editing, printing & extracting.
 - No Software Installation Required. Everything is done online.

What CrackMyPDF Can't Do
Our PDF Restrictions Remover can work to remove the restrictions in standard password protected PDF file, including 40-bit RC4 ecryption, 128-bit RC4 decryption and 128-bit AES decryption.

 But it can NOT:

 - Remove or find the user/open password automatically.
 - Remove other protections, such as DRM or third part plug-in.

Thursday, September 10, 2015

Import CRM 2011 Solution Into 2015

In order to import a 2011 solution into 2015 you must first import it into 2013 then re-export from there.  Additionally if you solution contains all 2015 compliant components you can manually edit the solution.xml file within the solution to the following…...