locked
SCSM 2012 Review Activity and System Owner RRS feed

  • Question

  • Hi!

    I´am building a new service / request offering in SCSM 2012 and would need help to determine if the following is possible:

    We create a request offering that let the user choose among the business services (a query that shows all business services). After the Service Request is created, a review activity is triggered. Is there some way we could use the Business Service Owner as reviewer to this review activity?

    So far I havent been able to find any way, but hopefully you guys know more than me! :-) If this does not work, do you have any other ideas of workaround? Is Orchestrator able to receive the business service, extract the owner and then add it to the review activity?

    Kind Regards,

    Ezequiel Osorio

    Relevo AB


    E.O
    Thursday, December 15, 2011 1:59 PM

Answers

  • You should give it a try with PowerShell using SMlets (http://smlets.codeplex.com) and a workflow.

    • Workflow should be triggered "on create"
    • Run a PowerShell script to set the reviewer
    • Get the owner of the related business service
    • Set the owner of the business service as reviewer

    The PowerShell script might me a little complex. Because you have some relationships between the Service Request -> related Business Service , Service Request and the related Review Activity.

    But I am very positiv it can be done by PowerShell.

    Orchestrator is an option as well.


    Andreas Baumgarten | H&D International Group
    • Proposed as answer by AndersAsp Thursday, December 15, 2011 9:16 PM
    • Marked as answer by E.O Wednesday, December 21, 2011 2:47 PM
    Thursday, December 15, 2011 2:54 PM
  • Dynamic approval steps in Service Manager with a bit of Orchestrator magic

    http://www.scsmsolutions.com/ freemanru (at) gmail (dot) com


    Monday, March 26, 2012 8:58 AM
  • A new version of SMLets (beta 4) were released the other day. Idk if it's fixed in this version but based upon my conversation with Jim earlier I think it is.

    http://smlets.codeplex.com

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    • Marked as answer by E.O Wednesday, March 28, 2012 11:30 AM
    Wednesday, March 28, 2012 8:14 AM

All replies

  • You should give it a try with PowerShell using SMlets (http://smlets.codeplex.com) and a workflow.

    • Workflow should be triggered "on create"
    • Run a PowerShell script to set the reviewer
    • Get the owner of the related business service
    • Set the owner of the business service as reviewer

    The PowerShell script might me a little complex. Because you have some relationships between the Service Request -> related Business Service , Service Request and the related Review Activity.

    But I am very positiv it can be done by PowerShell.

    Orchestrator is an option as well.


    Andreas Baumgarten | H&D International Group
    • Proposed as answer by AndersAsp Thursday, December 15, 2011 9:16 PM
    • Marked as answer by E.O Wednesday, December 21, 2011 2:47 PM
    Thursday, December 15, 2011 2:54 PM
  • Thank you for you suggestion, we will give it a try.

    So, what you suggest is a workflow that triggers when the custom service request is created, that gets the related business service from related items, then reads the system owner and set the owner to the review activity related to the custom service request.

    It sounds like it should be possible, though somewhat complex :-) We will set up an orchestrator RC and see if maybe it could be done there as well.

    Since we can choose the business service in the portal i was hoping it would be possible to somehow map it to the review activity, but it does not seem that the reviewer is possible to map from any kind of field from the portal. That would have made it easy!

    A follow upp question: What is the difference between business service and a service map? When I create the request offering fields i can choose a query from a basic class business service which presents all business services, but if I choose for example service map (advanced), that is a type projection with relationship to users/service owners, i cannot see any of our business services! Any thoughts?

    Kind Regards,

    Ezequiel Osorio

    Relevo AB


    E.O
    Thursday, December 15, 2011 7:35 PM
  • Hi,

    I tested and I can confirm that this was indeed possible through a powershell script. I haven´t yet created a workflow but will test this soon. Thank you.

    If anyone is interested in the solution i´ll try to publish it here or somewhere else.

     

    Kind Regards,

    Ezequiel Osorio

    Relevo AB


    E.O
    Wednesday, December 21, 2011 2:48 PM
  • Hi, I'm working on getting SCSM 2012 workflows setup and want to use a dynamic lookup of the manager of an AD group and then assign the review task to the manager of the group which is very similar to what you are doing. Can you post the solution or give me some direction to how this was accomplished with SCSM 2012?

    Thanks,

    Ray


    Ray
    Friday, January 20, 2012 2:42 AM
  • Hi Ray,

    Send me an e-mail on ezequiel dot osorio AT relevo dot se and I´ll send the solution to you. Its just to bad commented to publish here :-)

    Kind Regards,

    Ezequiel Osorio


    E.O
    Friday, January 20, 2012 8:32 AM
  • Hi again,

    One quick question,

    The PS-script works fine and the reviewer is added as it shoud - however(!) - since we trigger a mail notification to the reviewer when the review activity is updated to status "in progress", sometimes the reviewer is not yet added when the mail is sent and the mail notification is lost.

    Would you happend to have any good ideas on how to stall the mail notification a minute or two, so that the PS-script have time to add the reviewer before it tries to send the notification?

    Thanks in advance,

    Kind Regards,

    Ezequiel Osorio


    E.O

    EDIT: I think I´ll just create a new automated activity that will run before the review activity.
    • Edited by E.O Wednesday, March 7, 2012 7:23 AM
    Tuesday, March 6, 2012 4:08 PM
  • You're having a workflow timing issue..i.e. many workflows firing based on the same criteria (or similarly timed criteria)..unfortunately, you can't determine which workflow fires first. (In comp sci, that's non-determinism :) ) So, you need to explicitly define the event sequence for which your workflows will fire..(in other words, you force your workflows to fire in a deterministic order)

    So, I have a possible solution you could try (I did something similar in my own environment):

    Add a "reviewer assignment" activity before your review activity. When the "reviewer assignment" activity goes in progress, use your ps script to find your reviewer, relate it to your review activity, then complete the "reviewer assignment" activity. In that way, you can be sure that your review activity will always have a reviewer before the review activity ever goes in progress..thus ensuring that your notification is sent out only when a reviewer is in the review activity.

    (edit) Another possible solution..if you don't want an extra activity in the mix, you could do the following: Add a custom property to the review activity..something like a boolean "Reviewer Added"..default it to false.
    Next, set your reviewer assignment workflow (your ps-script) to trigger when a review activity goes in progress. The last step of your script would then set "Reviewer Added" to true.
    Next, set your notification criteria to be "trigger on update when status = in progress _and_ "Reviewer Added" changes from false to true".

    Again, you have forced a sequence of events. Your notification won't send until "reviewer added" is true and you won't change "reviewer added" until your script has added a reviewer. Admittedly, I didn't try this second solution, but theoretically it should work ok.

    Tuesday, March 6, 2012 6:29 PM
  • Hi Aaron!

    Thank you for the excellent answer. I have created an acitivty that runs the workflow before the review activity now to avoid the timing issue. That seems to work fine.

    But I do get another issue, and I cannot really understand why this happens. Please, anyone, I need help to explain this?

    I have a Service Request template now with 3 activities (2012 RC version). First activity has a workflow to add the reviewer to the second activity. The third activity is a manual activity.

    The powershell script works 100% of the times when run manually in a powershell command prompt. The reviewer is added to the following review activity.

    But when it is run from the 1st acitivty with a workflow triggered on creation on that activity, the exact same powershell script works randomly. It always reports "successful" in the log but does not always add the revivewer (which is the owner of a business service). Works most of the times, but suddenly it dont work. Then starts to work again.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------

    The powershell script that has been cut and pasted from several other scripts and more stuff added (possibly terrible code, i´am not a developer):

    (its a manual activity, checks parent SR, checks related review activity, adds relationship objects to review activity that is the business service owner)

    import-module SMLets -force

    $Manactivityclass = get-scsmclass System.WorkItem.Activity.ManualActivity$
    $MactivityProjection = get-scsmtypeprojection System.WorkItem.Activity.ManualActivityProjection$
    $GetParentSRID = Get-SCSMObjectProjection $MactivityProjection|?{$_.Id -eq "$MA"}|%{$_.WorkItem}  ///$MA is the ID of the activity!!
    $srid = $GetParentSRID.Id
    $isdel = "False"
    $ReviewActivityClass = get-scsmclass System.WorkItem.Activity.ReviewActivity$
    $SRProj = Get-SCSMTypeProjection System.WorkItem.ServiceRequestProjection$
    $GetBS = Get-SCSMObjectProjection $SRProj|?{$_.Id -eq $srid}|%{$_.HasRelatedWorkItems}
    $BSName = $GetBS.DisplayName
    $service = Get-SCSMObject -Class (Get-SCSMClass -Name System.Service$) -Filter "DisplayName -eq $BSName"
    $owner = (Get-SCSMRelationshipObject -BySource $Service | ?{$_.IsDeleted -ne $isdel} | ?{$_.RelationshipId -eq "CBB45424-B0A2-72F0-D535-541941CDF8E1"}).TargetObject
    $SRhasReview = Get-SCSMObject -Class (Get-SCSMClass -Name System.WorkItem.ServiceRequest$) -Filter "ID -eq $srid"
    $activityRel = Get-SCSMRelationshipClass sactivity
    $Ractivity = Get-SCSMRelatedObject -SMObject $SRhasReview -Relationship $activityRel|Where{$_.TypeName -eq $ReviewActivityClass}
    $ReviewerClass = get-scsmclass System.Reviewer$
    $RevIsUser = get-scsmrelationshipclass System.ReviewerIsUser
    $RevActivityHasReviewer = get-scsmrelationshipclass System.ReviewActivityHasReviewer
    $reviewerArgs = @{ ReviewerId = "{0}" }
    $reviewer = new-scsmobject -class $reviewerClass -prop $reviewerArgs -nocommit
    $ro1 = new-scsmrelationshipobject -nocommit -rel $RevActivityHasReviewer -sou $Ractivity -tar $reviewer
    $ro2 = new-scsmrelationshipobject -nocommit -rel $RevIsUser -Sour $reviewer -targ $owner
    $ro1.Commit()
    $ro2.Commit()

    remove-module SMLets

    Any ideas out there, please? I´m about to give up! I have no idea if its the workflow engine or the code or something else that fails but I just cant get it to work 100%!

    Kind Regards

    E.O


    E.O

    Wednesday, March 7, 2012 4:52 PM
  • The first thing I always check is the Operations Manager event log on the management server. Are there any errors in there around the time your ps script "fails"?

    You could also try having your ps script output everything it does to a file or event log to help you trace exactly what it's doing.

    If you don't mind a tip, your script workflow should trigger on your first activity when it goes "in progress", not when it's created. In your particular scenario, it doesn't look like it matters, but (not to sound like a broken record) it's a timing thing. After a workitem is created, other built-in service manager workflows manipulate it (setting the work item and first activity to in progress, setting other activities to pending, etc). When the first activity is set to "in progress", it's safe to assume that Service Manager's built-in workflows are finished with it (as long as the first activity in your template isn't set to "in progress" :) )

    Wednesday, March 7, 2012 6:02 PM
  • Hi and thank you again,

    Found out what caused the error. It was not exactly what you said but _definitly_ a timing issue.

    The workflow takes about 1 minute to complete and if you or someone else tries to run it (again) during this time, it will fail and the following attempts will fail as well. This will not be that common when in production but could happen and since it is a pretty important script i´ll try to handle this. Maybe a check if the SMLets module is already loaded or something like that would work?

    Kind Regards,


    E.O

    Thursday, March 8, 2012 4:17 PM
  • Were you able to fix this problem yet? What is the error you're getting?

    Monday, March 12, 2012 1:57 PM
  • Hi,

    Not yet unfortunately.

    No error is reported (i have no working error handling in the powershell script for the moment) so the workflow runs for 5-10 seconds and reports that it has run successfully (when a previous workflow is still running). It seems to exit the powershell script pretty quick since the workflow takes about 1 minute or more when it works.


    E.O

    Monday, March 12, 2012 2:48 PM
  • Hi again,

    The error seems to be the same that others are experiencing when workflows "collide" or runs at the same time. The powershell module is already loaded or in use, and therefore the workflow does not complete. If we wait until the workflow is finished it works fine!

    Regards,

    Ezequiel Osorio


    E.O

    Monday, March 19, 2012 12:28 PM
  • This is a known issue in the current version of SMLets, it's fixed in the upcoming version.

    Send a mail to Jim Truher and ask him about this and he might be able to provide you with the updated files.

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    Monday, March 19, 2012 1:02 PM
  • Thanks, no reply yet but i´ll wait for the upcoming SMLets. I managed to make the powershell code much faster so the problem does not occur very often.

    Kind Regards,

    E.O


    E.O

    Monday, March 26, 2012 8:05 AM
  • Dynamic approval steps in Service Manager with a bit of Orchestrator magic

    http://www.scsmsolutions.com/ freemanru (at) gmail (dot) com


    Monday, March 26, 2012 8:58 AM
  • Hi, and thanks! We have not yet incorporated Orchestrator yet but thats a great way to do this, absolutely!

    Regards,

    Ezequiel Osorio

    Relevo AB


    E.O

    Monday, March 26, 2012 11:27 AM
  • A new version of SMLets (beta 4) were released the other day. Idk if it's fixed in this version but based upon my conversation with Jim earlier I think it is.

    http://smlets.codeplex.com

    Regards
    //Anders


    Anders Asp | Lumagate | www.lumagate.com | Sweden | My blog: www.scsm.se

    • Marked as answer by E.O Wednesday, March 28, 2012 11:30 AM
    Wednesday, March 28, 2012 8:14 AM
  • Since i did the code faster the problem do not arise that often but i did create 4 requests very rapidly with only seconds between them (and had a tester do the same). Since the implementation of SMLets version 4 we cannot reproduce the error any more!

    And that are great news! :-)

    Thanks for all the help.

    Kind Regards,

    Ezequiel Osorio

    Relevo AB


    E.O

    Wednesday, March 28, 2012 11:30 AM