locked
Mapping prompts to relationship fields RRS feed

  • Question

  • Other than Orchestrator is there any way to do this from within the console?

    I need to create a RO which will submit a SR that contains a Review Activity.  I want the user to pick the reviewer from a Query List.  The reviewer needs to receive a notification that they have an activity waiting that needs their attention.

    So the hard part for me is placing the user that is picked via query list in either a review activities reviewer field or even a manual activities activity implementer field.  

    I am open to powershell suggestions as well.  We just don't have Orch implemented yet.  


    - Get on the floor, do that dinosaur

    Friday, June 21, 2013 4:19 PM

Answers

  • I had to use Orchestrator and add a runbook activity.

    Heres how to add the reviewer: http://www.scsm.se/?p=895 

    From the query result on the RO, make the user a related configuration item. Then in the runbook, you wont be able to select that relationship, so exclude all the other relationships: assigned to, affected user, etc...

    I hope that helps. Good luck!


    - Get on the floor, do that dinosaur

    • Marked as answer by Pete Barbuto Sunday, November 17, 2013 7:38 PM
    Sunday, November 17, 2013 7:38 PM

All replies

  • Sure you can do this using only Service Manager. For this to work you have to create the service request on the portal, then during the service configuration you must configure a "query result" option as a prompt, during the step to configure the query result, on the step 4 (options) you can configure that the user must be assigned as a reviewer on the review activity.

    hope this work for you.

    Cheers.


    Javo Mejia|Colombia| Blog: http://javomejia.glup.com.co

    Friday, June 21, 2013 4:51 PM
  • Well, I can add the user as either a related or an affected configuration item.  But it doesn't actually make the user a reviewer.  

    - Get on the floor, do that dinosaur

    Friday, June 21, 2013 7:01 PM
    • Marked as answer by Pete Barbuto Friday, June 21, 2013 7:48 PM
    • Unmarked as answer by Pete Barbuto Sunday, November 17, 2013 7:39 PM
    Friday, June 21, 2013 7:45 PM
  • mmmmmm.... I see...... let me check.....


    Javo Mejia|Colombia| Blog: http://javomejia.glup.com.co

    Friday, June 21, 2013 7:46 PM
  • @Javo: maybe a feature in R2? :). This sounds too good to be true, but I had to test it, and no the user will not be added as a reviewer on the RA. Please explain how then if it's possible.


    Pete you could do this via a powershell workflow that triggers when your SR is created. You can make this via the Authoring tool, and setup the criteria so it only captures your specific RO related SR.

    This powershell script will get you started. (Just a prototype I made, you'll need to make some error handling etc. of course). It assumes you put the user as related object on the SR.

    param ([string]$Id)
    
    #Load Module
    if (!(Get-Module smlets)) {Import-Module smlets -force -ErrorAction stop}
    
    #Get related user from SR
    $srClass = Get-SCSMClass -Name system.workitem.servicerequest$
    $SR = Get-SCSMObject -Class $srClass -Filter "Id -eq $Id"
    
    $relClassRelatesToConfig = Get-SCSMRelationshipClass System.WorkItemRelatesToConfigItem
    $RelatedUsers = Get-SCSMRelatedObject -SMObject $SR -Relationship $relClassRelatesToConfig | ?{$_.ClassName -eq "System.Domain.User"}
    
    
    if ($RelatedUsers)
    {
        #Get relevant Review Activity
        $relClassContainsActivity = Get-SCSMRelationshipClass system.workitemContainsActivity
    
        # ** If you have more than one activity you will need to specify which RA with a | where($_.Title = "Your RA title"} or something else.
        $RA = Get-SCSMRelatedObject -SMObject $SR -Relationship $relClassContainsActivity 
    
        foreach ($RelatedUser in $RelatedUsers)
        {
            
            
            #Commit Related User to Review Activity
            $relClassReviewerIsUser = Get-SCSMRelationshipClass System.ReviewerIsUser
            $relClassReviewActivityHasReviewer = Get-SCSMRelationshipClass System.ReviewActivityHasReviewer
            
            $reviewerClass = get-scsmclass System.Reviewer
            $reviewerArgs = @{ ReviewerId = "Reviewer{0}" }
            #$reviewerArgs.Comments = "optional comments" 
            #$reviewerArgs.Veto = $true / $false 
            #$reviewerArgs.MustVote = $true / $false
            
            $reviewer = new-scsmobject -class $reviewerClass -PropertyHashtable $reviewerArgs -nocommit
            
            $ro1 = new-scsmrelationshipobject -nocommit  -Relationship $relClassReviewActivityHasReviewer -sou $RA -tar $reviewer
            $ro2 = new-scsmrelationshipobject -nocommit  -rel $relClassReviewerIsUser -Sour $reviewer -targ $RelatedUser
            $ro1.Commit()
            $ro2.Commit()
    
        }
    
    }
    
    




    Friday, June 21, 2013 9:23 PM
  • yeah right!! I saw the feature but I just probe it and it does not work!! the reviewer is assigned as blank user...


    Javo Mejia|Colombia| Blog: http://javomejia.glup.com.co

    Friday, June 21, 2013 9:29 PM
  • Pete, I have this exact requirement..will you please expain what you did to achieve this?

    Thanks

    Sunday, November 17, 2013 3:24 PM
  • I had to use Orchestrator and add a runbook activity.

    Heres how to add the reviewer: http://www.scsm.se/?p=895 

    From the query result on the RO, make the user a related configuration item. Then in the runbook, you wont be able to select that relationship, so exclude all the other relationships: assigned to, affected user, etc...

    I hope that helps. Good luck!


    - Get on the floor, do that dinosaur

    • Marked as answer by Pete Barbuto Sunday, November 17, 2013 7:38 PM
    Sunday, November 17, 2013 7:38 PM
  • Thanks Pete :) ..I am trying this in My lab.

    On the same context : I have ceated a custom form and added a user picker to it...the user picker is actually a head of the Department. So while submitting the request the requestor will be asked his department (select from Drop down list) and his dept Head (select in the user picker field). Then my idea is to add the department head as the reviewer to the service request...

    Now the problem is..when I am creating the RO, i dont have the option to map a user input against a user picker field..why so? I mean, non of the user pickers can be mapped through the prompt questions...it actally does not show up in the configure prompts tab..why?

    Thanks,


    Thanks

    Monday, November 18, 2013 3:36 PM
  • Right, yea that would be too easy. You can only map to properties of class. The user picker fields are actually relationships to other configuration items, and you cannot map one CI to another via RO. You cannot map relationships. Sorry. 

    So you'll have to find a way to use orchestrator to grab related CIs from the query result and create a new relationship with Head of Department via runbook.


    - Get on the floor, do that dinosaur

    Monday, November 18, 2013 5:38 PM
  • Thanks a lot :)


    Thanks

    Monday, November 18, 2013 7:38 PM