Hi!
I'm trying to create a Service Request programmatically by creating a new projection object and then applying a template with 4 activities.
The problem is, I can apply the template successfully, but I'm trying to add the Id property for the child activities with the right prefix, but for some reason I cannot navigate the activities on the projection unless I submit the changes:
$NewReqProj = @{ __CLASS = "System.WorkItem.ServiceRequest"; __OBJECT = @{ Id = "SR{0}" Status = (Get-SCSMEnumeration ServiceRequestStatusEnum.New$).Id.Guid CreatedDate = (Get-Date).ToUniversalTime() UserInput = $UserInput }; } $NewRequest = New-SCSMObjectProjection -Type System.WorkItem.ServiceRequestProjection -Projection $NewReqProj -NoCommit $NewRequest.ApplyTemplate($ReqTemplate) PS C:\> $NewRequest.Object ClassName DisplayName LastModified --------- ----------- ------------ System.WorkItem.ServiceRequest SR5176 1/1/0001 12:00:00 AM PS C:\> $NewRequest Key Value --- ----- Activity {} Activity {} Activity {} Activity {}
Is anybody aware of any way of getting to the child activities and adding the Id property to them so I can commit the changes right after that?
Thanks!
German