Thanks, Jim! You gave me some hints...
Sorry to hear you're out of the SM team... :(
I'll share my findings with the rest in case you're looking for this:
Sorry to hear you're out of the SM team... :(
I'll share my findings with the rest in case you're looking for this:
function Add-SRComment {
param (
[parameter(Mandatory=$true,Position=0)][Alias('SRObject')]$pSRObject,
[parameter(Mandatory=$true,Position=1)][Alias('Comment')][String]$pComment,
[parameter(Mandatory=$true,Position=2)][Alias('EnteredBy')][String]$pEnteredBy
)
$NewGUID = ([guid]::NewGuid()).ToString()
$Projection = @{__CLASS = "System.WorkItem.ServiceRequest";
__SEED = $pSRObject;
AnalystCommentLog = @{__CLASS = "System.WorkItem.TroubleTicket.AnalystCommentLog";
__OBJECT = @{Id = $NewGUID;
DisplayName = $NewGUID;
Comment = $pComment;
EnteredBy = $pEnteredBy;
EnteredDate = (Get-Date).ToUniversalTime();
IsPrivate = $false
}
}
}
New-SCSMObjectProjection -Type "System.WorkItem.ServiceRequestProjection" -Projection $Projection
}
Add-SRComment -SRObject $SR -Comment "This is a test" -EnteredBy "Doe, John"