Hi @jansi rani krishnan ,
it's almost the same like this one: https://learn.microsoft.com/en-us/answers/questions/498265/need-help-on-powershell-coding-regarding-scsm.html
Here we go:
# Set Manual Activity Description field
Import-Module SMlets
$smdefaultserver = "SCSM1"
# Define properties
$maID = "MA2114"
$SysID = "c21f57971b6d7c101d777b75464bcb26"
$SNOWticketID = "TASK0055836"
$status = "inserted"
######
$maClass = Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity$
# Get SCSM objects
$maObj = Get-SCSMObject -Class $maClass -Filter "ID -eq $maID"
# Update IR Alternate Contact Method
if (($status -eq "inserted") -and ($maObj)) {
$UpdateDescription = "Sysid: $SysID | SNOW ticket number: $SNOWticketID | Correlation_id: $maID"
Set-SCSMObject -SMObject $maObj -Property "Description" -Value $UpdateDescription
}
#######
# Get the data out of the Manual Activity Description field
$maID = "MA2114"
$maClass = Get-SCSMClass -Name System.WorkItem.Activity.ManualActivity$
$maObj = Get-SCSMObject -Class $maClass -Filter "ID -eq $maID"
$maDescription = $maObj.Description
$sysID = ($maDescription.Split("|")[0].Split(":").Trim())[1]
$SysID
# Get SNOW Ticket ID
$SNOWticketID = ($maDescription.Split("|")[1].Split(":").Trim())[1]
$SNOWticketID
# Get SCSM MA ID
$maID = ($maDescription.Split("|")[2].Split(":").Trim())[1]
$maID
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten