Home Analyst Portal
Options

Delete Workitem or Activity from Portal

Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
is there any way (without a runbook) to delete an activity for example from a SR or CR. My first attempt which I thought might work is I made a copy of the ticket, removed the activity and committed the projection but it appears that doesnt work. Anyone attempt anything like this?

Best Answer

  • Options
    Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    Answer ✓
    thanks for the reply Billy, that is an interesting idea I might have to try explore that avenue, for this solution to work I would probably have to find a way to hide the MA from view until the workflow could clean it up while also skipping the hidden activity so it would atleast go to the next while its pending deletion. I will post my solution if I find a way to do this. Any other suggestions or if anyone has hidden activties or anything would be a great help

Answers

  • Options
    Billy_WilsonBilly_Wilson Member Ninja IT Monkey ✭✭✭✭
    did you try this (requires SMLets)? - 

    Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.Activity$) -Filter "DisplayName -eq MA544555" | Remove-SCSMObject -Force

    Disclaimer :) - deleting work items is against ITIL best practices. It is recommended that you test this in a development environment before using it in production and make sure you have appropriate backups.
  • Options
    Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭

    Actually this was a portal only feature, since we have dynamic change requests where our service owners can add tasks like project online (MA's from Commit) on the fly to build out there change, it is necessary to do this from the portal. The powershell options was apparent to me same as the runbook but when a service owner by accidently adds to many activities them waiting for a workflow to kick off or runbook is a very slow and undynamic solution so we avoided going down that path.

    Current all RA's and MA's are added from portal tasks, so I'm trying to figure out if its possible to do any removals on accidental adds.

  • Options
    Billy_WilsonBilly_Wilson Member Ninja IT Monkey ✭✭✭✭
    so basically a Portal task that service owners can use in case they accidentally add an activity they didn't need to, correct?
  • Options
    Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    edited October 2017
    yeah exactly, whoops I accidentally hit yes on that. But you are totally correct thats exactly the sort of thing I am attempting
  • Options
    Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    Is there anyway too remove the accepted answer? I hit yes on accident lol or should I just repost?
  • Options
    Billy_WilsonBilly_Wilson Member Ninja IT Monkey ✭✭✭✭
    Hi Davin,

    I'll have the webmaster remove the accepted answer. In the meantime, I spoke with one of our top consultants who informed me that the API will not accept deleting items and that you would probably have to use a webhook that's call PS from another server (or Azure). If it were me, i'd add a boolean extension to the Activity class and have a monitoring runbook that would run the deletion PS when the Boolean = true. Not what you were looking for, I know, but hopefully somebody else will have a better suggestion.

    Thanks. 
  • Options
    Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    Answer ✓
    thanks for the reply Billy, that is an interesting idea I might have to try explore that avenue, for this solution to work I would probably have to find a way to hide the MA from view until the workflow could clean it up while also skipping the hidden activity so it would atleast go to the next while its pending deletion. I will post my solution if I find a way to do this. Any other suggestions or if anyone has hidden activties or anything would be a great help
  • Options
    Bill_CrumBill_Crum Customer IT Monkey ✭

    Davin's idea is a great one, and if you set the runbook up as a monitor for any updates to Manual Activities, it would be very quick in the deletion once the Activity was saved. I would bet within 60 seconds easy.

Sign In or Register to comment.