Home Service Manager

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 ✭
    Answer ✓
    Thank you very much for the direction and assistance.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    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 Ninja IT Monkey ✭✭✭✭
    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 ✭
    Answer ✓
    Thank you very much for the direction and assistance.
  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    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 Ninja IT Monkey ✭✭✭✭
    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 Ninja 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:
    <div>9de908a1-d8f1-477e-c6a2-62697042b8d9&nbsp;&nbsp;	--&nbsp;&nbsp;completed - Default
    </div><div>144bcd52-a710-2778-2a6e-c62e0c8aae74&nbsp;&nbsp;	--&nbsp;&nbsp;failed - Default
    </div><div>EAEC5899-B13C-D107-3E1A-955DA6BF9FA7&nbsp;&nbsp;	--&nbsp;&nbsp;skipped&nbsp;&nbsp;
    <span style="background-color: transparent; color: inherit; font-size: inherit; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">89465302-2A23-D2B6-6906-74F03D9B7B41&nbsp;&nbsp;	--&nbsp;&nbsp;canceled&nbsp;</span>
    </div>
    Other:
    <div>11FC3CEF-15E5-BCA4-DEE0-9C1155EC8D83&nbsp;&nbsp;	--&nbsp; active&nbsp; 
    <span style="background-color: transparent; color: inherit; font-size: inherit; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">d544258f-24da-1cf3-c230-b057aaa66bed&nbsp;&nbsp;	--&nbsp;&nbsp;on hold&nbsp;</span>
    </div><div>50C667CF-84E5-97F8-F6F8-D8ACD99F181C&nbsp;&nbsp;	--&nbsp;&nbsp;ready
    </div><div>BAA948B5-CC6A-57D7-4B56-D2012721B2E5&nbsp;&nbsp;	--&nbsp;&nbsp;rerun&nbsp;</div>
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Ninja 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 Ninja 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 Ninja 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<br>$Cancelled = Get-SCSMEnumeration -Name ActivityStatusEnum.Cancelled<br><br>$ServiceRequest = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "Id -eq SRQ259140"<br><br>$ChildActivities = (Get-SCSMRelationshipObject -BySource $ServiceRequest |?{$_.RelationshipID -eq "2da498be-0485-b2b2-d520-6ebd1698e61b"})<br><br>$ChildActivities | %{$Activity = Get-SCSMObject -ID $_.TargetObject.Id; if($Activity.Status -eq $InProgress){$Activity | Set-SCSMObject -Property Status -Value $Cancelled<b>; Get-SCSMRelationshipObject -BySource $Activity -Filter "RelationshipId -eq '15e577a3-6bf9-6713-4eac-ba5a5b7c4722'" | Remove-SCSMRelationshipObject</b>}}
    Bold part is the added code
  • Richard_ByersRichard_Byers Customer IT Monkey ✭
    That script works great for SR's in Failed Status, but what if the SR is in Closed Status?  Thanks!
  • Justin_WorkmanJustin_Workman Cireson Support Super IT Monkey ✭✭✭✭✭
    @Richard_Byers
    This is only going to get Failed activities inside Closed SRs.  From my original description above it looks like I meant to target 'Pending' activities and set them as cancelled, but the script actually targets 'Failed' activities.  If you're looking for Failed activities in Closed SRs, this will do it.  If you want to adjust the activity status being targeted you can change the 'Failed' to whatever status you want.
    $closedStatus = Get-SCSMEnumeration -Name ServiceRequestStatusEnum.Closed
    
    $SR = Get-SCSMObject -Class (Get-SCSMClass -name System.WorkItem.ServiceRequest$) -Filter "Status -eq $($closedStatus.id)"<br>
    <br>foreach ($s in $SR) {&nbsp; &nbsp; $ro = Get-SCSMRelatedObject -SMObject $s -Relationship (Get-SCSMRelationshipClass -Name system.workitemcontainsactivity)
    
    &nbsp; &nbsp; foreach ($r in $ro) {
    
    &nbsp; &nbsp; &nbsp; &nbsp; if ($r.status.DisplayName -eq 'Failed') {
    
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $r | Set-SCSMObject -Property Status -Value Cancelled
    
    &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }}
Sign In or Register to comment.