How to clear pending Service request's manual or review activities from a Failed Service request

David_WurlDavid_Wurl Customer IT Monkey ✭

Best Answers

  • David_WurlDavid_Wurl Customer IT Monkey ✭
    Accepted Answer
    Thank you very much for the direction and assistance.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Accepted Answer
    @Justin_Workman is there a possibility to run workflow that close the SR where activities are cancelled? There is option i menu to closed the SR and nedd to closed by PS.
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    Accepted Answer
    Thomas describes here, how to create a workflow, which cancels activities when a SR fails: https://blogs.technet.microsoft.com/thomase/2013/07/30/cancel-pending-activities-in-a-failed-service-request/

Answers

  • David_WurlDavid_Wurl Customer IT Monkey ✭
    Accepted Answer
    Thank you very much for the direction and assistance.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Accepted Answer
    @Justin_Workman is there a possibility to run workflow that close the SR where activities are cancelled? There is option i menu to closed the SR and nedd to closed by PS.
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    Accepted Answer
    Thomas describes here, how to create a workflow, which cancels activities when a SR fails: https://blogs.technet.microsoft.com/thomase/2013/07/30/cancel-pending-activities-in-a-failed-service-request/

  • David_WurlDavid_Wurl Customer IT Monkey ✭
    Appreciate all the Help, working to keep al the one's and zero's in order.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    edited November 2017
    @Konstantin_Slavin-Bo, by default all "Failed" and "Cancelled" SR need to be closed manually and Cireson AutoClose don't close it?
    So you use Thomas workflow? 
    From your practise, what status value should be set for Activities and SR when SR is failed or cancelled?

    Im asking according to Dashboard results, where in default report of Active MA shows MA in status "Cancelled", "Skipped" also when they are in SR with status "Closed".

    And also in "Failed" are not closed automaticly and activities are shown in Analitycs list


  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    @Marek_Lefek
    I don't know about Cirons AutoClose (we don't use it because it can't take holidays and weekends into account), but by default, all pending activities are left in the pending state, when a SR fails or is cancelled.

    We set all pending activities to cancelled, when a SR is failed or cancelled.

    I checked, and the default query for Current > Manual Activity dashboard only excludes Failed and Completed activities. I can help you rewrite the query, so it excludes more statuses, if you want? Which MA statuses do you want the dashboard to include in the count?
    • Completed
    • Cancelled
    • Skipped
    • In Progress
    • On Hold
    • Failed
    • Rerun
    • Pending
    My immediate thought would be to only show In Progress, Pending and maybe Rerun? What about On Hold?
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    edited November 2017
    I Agree, I will ad On Hold and Rerun as well. 

    In portal Settings > DashBoard Query Settings, I change source called "Active Manual Activities By Category". This works for Cireson Analitycs but don't works for Cireson Dashoboard.

    In the source I change one line where I add 2 more exclusion. This appear in 2 places in those query. Full query in attachement:
    Default version:
    AND wi.StatusId NOT IN('9de908a1-d8f1-477e-c6a2-62697042b8d9','144bcd52-a710-2778-2a6e-c62e0c8aae74')
    Chenge for: 
    AND wi.StatusId NOT IN('9de908a1-d8f1-477e-c6a2-62697042b8d9','144bcd52-a710-2778-2a6e-c62e0c8aae74','EAEC5899-B13C-D107-3E1A-955DA6BF9FA7','89465302-2A23-D2B6-6906-74F03D9B7B41')

    Below I listed StatusID from list "ActivityStatusEnum" :
    Excluded from the report:
    9de908a1-d8f1-477e-c6a2-62697042b8d9  	--  completed - Default
    144bcd52-a710-2778-2a6e-c62e0c8aae74  	--  failed - Default
    EAEC5899-B13C-D107-3E1A-955DA6BF9FA7  	--  skipped  
    89465302-2A23-D2B6-6906-74F03D9B7B41  	--  canceled 
    
    Other:
    11FC3CEF-15E5-BCA4-DEE0-9C1155EC8D83  	--  active  
    d544258f-24da-1cf3-c230-b057aaa66bed  	--  on hold 
    50C667CF-84E5-97F8-F6F8-D8ACD99F181C  	--  ready
    BAA948B5-CC6A-57D7-4B56-D2012721B2E5  	--  rerun 
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    @Marek_Lefek
    Yeah, analytics and dashboard are using different queries. I looked into it, and the query doesn't have a title, but you should be able to find the query for Manual Activity Dashboard by sorting the view by Query Ascending, and it should then be the 8th query, beginning with IF(@UserId IS NULL) BEGIN SELECT ds.DisplayString Tier, count(*) Active....



    The structure of the query is almost identical to the corresponding analytics query, so you should be able to add the status id's in the same manner.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Thanks @Konstantin_Slavin-Bo.  I also change the title of this query and it still works:)
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    edited November 2017
    No problem @Marek_Lefek, I'm happy to help! Yeah, you can change the title, it's no problem. The portal app uses an unique ID to find the query, so it still works.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    @Konstantin_Slavin-Bo do you clear "Activity Implementer" in cancelled or failed activities? We did not and it was showing in repors, daily analitycs notification, or in my work.
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    No we don't, but you can do it by getting and then removing the relationship object in the if-block  (assuming you are using Thomas Ellermann's solution):
    $InProgress = Get-SCSMEnumeration -Name ActivityStatusEnum.Ready
    $Cancelled = Get-SCSMEnumeration -Name ActivityStatusEnum.Cancelled

    $ServiceRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "Id -eq SRQ259140"

    $ChildActivities = (Get-SCSMRelationshipObject -BySource $ServiceRequest |?{$_.RelationshipID -eq "2da498be-0485-b2b2-d520-6ebd1698e61b"})

    $ChildActivities | %{$Activity = Get-SCSMObject -ID $_.TargetObject.Id; if($Activity.Status -eq $InProgress){$Activity | Set-SCSMObject -Property Status -Value $Cancelled; Get-SCSMRelationshipObject -BySource $Activity -Filter "RelationshipId -eq '15e577a3-6bf9-6713-4eac-ba5a5b7c4722'" | Remove-SCSMRelationshipObject}}
    Bold part is the added code
Sign In or Register to comment.