Home Service Manager

SCSM Add-on - Advanced History Groomer [w/ Source Code]

Conner_WoodConner_Wood Customer Advanced IT Monkey ✭✭✭
Hi all, I felt it would be beneficial to post on the Cireson Community Forums about the SCSM 2012 R2 - Advanced History Groomer Add-on.

Personally I think Cireson could benefit by looking at the source code provided.  Since we heavily rely on Cireson, we also heavily depend on their success.  Notably, there is code for retrieving SCSM Run As Account credentials for Impersonation.

As for other SCSM 2012 R2 Developers, if you are interested in creating your own C# Workflows using Visual Studio Community, this working example will be of great interest.

Comments

  • Adam_DzyackyAdam_Dzyacky Customer Contributor Monkey ✭✭✭✭✭
    Highest of fives @connor_wood !
  • Conner_WoodConner_Wood Customer Advanced IT Monkey ✭✭✭
    edited February 2017
    For those who want to manually purge history from the SCSM database (in case workflows have too much to handle), I figure you could use this SQL script which is what the Advanced History Groomer Add-on uses:
    USE ServiceManager;
    
    -- HardwareAsset (Cireson.AssetManagement.HardwareAsset) == MTV_Cireson$AssetManagement$HardwareAsset == C0C58E7F-7865-55CC-4600-753305B9BE64
    -- SoftwareAsset (Cireson.AssetManagement.SoftwareAsset) == MTV_Cireson$AssetManagement$SoftwareAsset == 81E3DA4F-E41C-311E-5B05-3CA779D030DB
    -- Organization (Cireson.AssetManagement.Organization) == MTV_Cireson$AssetManagement$Organization == ED0D8659-FBA9-6E08-C213-5CD88F5480A8
    -- CostCenter (Cireson.AssetManagement.CostCenter) == MTV_Cireson$AssetManagement$CostCenter == 128BDB2D-F5BD-F8B6-440E-E3F7D8AB4858
    
    DECLARE @ClassInstancesViewName varchar(max) = 'MTV_Cireson$AssetManagement$CostCenter';
    DECLARE @MPClassID varchar(max) = '128BDB2D-F5BD-F8B6-440E-E3F7D8AB4858'; -- BE SURE YOU SPECIFY THE CORRECT CLASS, OR IT WILL ERASE ALL HISTORY FROM TABLE ITEMS.
    DECLARE @RecentHistoryEntriesToKeep INT = 1;
    DECLARE @RetentionPeriodInMinutes INT = 2880;
    DECLARE @BatchSize INT = 2000;
    
    
    ---
    --SCRIPT BELOW THAT PURGES THE HISTORY AS DEFINED ABOVE.
    ---
    DECLARE @RetentionDateTimeUTC DateTime = DATEADD(minute, 

    Note:  If you have the class GUID, you can get what the viewname is by executing the following SQL Stored Procedure:
    exec [dbo].[p_GetTableAndViewName] 'ED0D8659-FBA9-6E08-C213-5CD88F5480A8'
    I recommend using SCSM Entity Explorer to get the class GUID.

Sign In or Register to comment.