DVLS Module: Set-DVLSEntryStatus

DVLS Module: Set-DVLSEntryStatus

avatar

Hi All

How it is currently possible to set an Entry Status without RDM?
Currently in Powershell Module i can only find Set-RDMEntryStatus.

Thanks and best Regards,
Andreas

All Comments (1)

avatar

Hello Andreas,

Here is an example of how to set a status on an entry:

# Status equivalence
# 0 -> No status, 1 -> Locked, 2 -> Disabled, 3 -> Warning, 4 -> Expired, 5 -> Archived, 6 -> Broken

$newStatus = 2
$statusMessage = 'My message'
$entryID = 'the entry id'
$entry = Get-DSEntry -EntryID $entryID

# Set the status property if it does not exist
if ($entry.status -eq $null) {
  $entry | Add-Member -MemberType NoteProperty -Name status -Value $newStatus
} else {
  $entry.status = $newStatus
}

# Set the statusMessage property if it does not exist
if ($entry.statusMessage -eq $null) {
  $entry | Add-Member -MemberType NoteProperty -Name statusMessage -Value $statusMessage
} else {
  $entry.statusMessage = $statusMessage
}

# Update the entry in the database
Update-DSEntryBase -JsonBody (ConvertTo-Json -InputObject $entry -Depth 10)


If you need further assistance, please let us know.

Best regards,
Maxime