Home Orchestrator
Options

Runbook to apply affected user from String

John_BeasleyJohn_Beasley Customer IT Monkey ✭
Ok, I have a Runbook that basically runs a Powershell script to read from a table of another system. All data is retrieved fine. I then have it create a SCSM Service Request. I update the properties of the request and the description. I am trying to take stringproperty12 which is an domain/user name and add that to the Affected User on the Service Request. Any Help would be greatly appreciated. 

Respectfully, 

John

Answers

  • Options
    Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    edited January 2019
    The general idea of what you'll need to do is first you'll need the User class, run a search against that class with the string you have, and then set that user as the Affected User on your SR. In order to complete this, you also need the SR/Work Item object to complete the relationship between the user and said work item.

    $domainUserClass = get-scsmclass -name <span>"System.Domain.User$<span>"<br></span></span>$affectedUserRelClass = get-scsmrelationshipclass -name "System.WorkItemAffectedUser$"<br>$affectedUser = Get-SCSMObject -class $domainUserClass -filter "Username -eq '<b>YOURSTRING</b>'"<br>New-SCSMRelationshipObject -Relationship $affectedUserRelClass -Source $<b>newWorkItem </b>-Target $affectedUser -<span>Bulk<br></span>


Sign In or Register to comment.