Setting "Activity Implementer" on Completion of Activity
Hi All,
I have been trying to figure out a way to automatically set the Activity Implementer whenever an activities status is changed from in-progress to completed in the portal.
The main reason we need to do this, is so that we can report on who completed different activities through the week / month, and analysts tend to forget to set the Activity Implementer to themselves.
As far as I can tell, there is no way of identifying the activity implementer OOB (e.g. there is no "CompletedByUser" relationship or similar for activities.), hence why I wanted to auto-set the implementer when it is changed to completed.
Unless there is a better way to do this, I was planning to do this via cusom.js code.
What I am wanting to do is create an onchange trigger on the status field, which then picks up the current analyst, and updates the activity implementer accordingly.
I can see this would be pretty straight forward with other fields, but with Activities I am not really sure where to start.
Any tips would be much appreciated.
Cheers!
Adrian
Best Answer
-
Billy_Wilson Member Ninja IT Monkey ✭✭✭✭No worries. I actually used PS to get the history on the Activity. Specifically the username of the person that set the MA to Completed status. You can pull that out of the .NET activity in the runbook.
The runbooks monitor for MAs that go into Completed status. If there is no Activity Implementer assigned, it runs the PS to get the username (using SMLets, so you need that installed), then gets that user's guid from SCSM so it can create the relationship for that user and the Activity Implementer in the MA. It also uses PS to get the date on which the MA was set to Completed and sets that date on the Actual End Date attribute of the MA (for reporting, etc).
Download the OIS_Export file and use what you need. Hope this helps.7
Answers
I actually did this at my former company using Orchestrator. I can zip up the rb and post it here if you are using SCO.
Nice. That would be great thanks..
Yes we are. I prefer to run my stuff in PowerShell if possible, but I can dissect the runbook to figure it out .
For interest sake... How did you manage to figure out who completed the activity via the runbook?
Regards,
Adrian
The runbooks monitor for MAs that go into Completed status. If there is no Activity Implementer assigned, it runs the PS to get the username (using SMLets, so you need that installed), then gets that user's guid from SCSM so it can create the relationship for that user and the Activity Implementer in the MA. It also uses PS to get the date on which the MA was set to Completed and sets that date on the Actual End Date attribute of the MA (for reporting, etc).
Download the OIS_Export file and use what you need. Hope this helps.
Cheers Billy!
Much appreciated.
Regards,
Adrian
@Billy_Wilson Very nice implementation i must say, i am gonna use this. HOw would you go about checking previous MA`s that have no activity implementor. Just list them all and check if there is a user or any string in the field and set the user from the history as you do inte script?
I am thinking of a way to scan the system looking for these MAs that are kind of orphans.
Thanks
Hi Robert,
Personally I'd make a copy of the one I posted above and drop the Monitor Object at the beginning for an Initialize data. Then import these runbooks and attach the copy to cycle through the orphans.
https://us.v-cdn.net/6026663/uploads/460/XZQLEU336VS5.zipHope this helps.
@Billy_Wilson Thx i will try this out
@Adrian_Paech here's similar discussion on how to add Add Implementer to Manual Activity in CR gets into In Progress state.
Solution suggested by @Adam_Dzyacky is basically the same: use Orchestrator to get user from parent ticket and fill it into MA in it.