Set-Volume
  • 2 Minutes to read
  • Dark
    Light
  • PDF

Set-Volume

  • Dark
    Light
  • PDF

Article summary

Summary

Updates an existing volume.

Set-Volume
    -Entry

Returns a volume object.

Parameters

ParameterTypeRequired?Notes
EntryVolume ObjectYes

Examples

Update an existing volume

# Update an existing volume

# A common flow for updating existing data is to first retrieve the data using the GET
# command, update specific fields, and then provide the modified data back using the SET command.

$entry = Get-Volume -Id 41

# Update a couple system fields:
$entry.DocCount = 1000
$entry.NativeCount = 1000
$entry.PageCount = 0

# Update a single choice custom field named "Volume Type" to "Produced to Opposing Counsel"
$volumeTypeField = $entry.Fields | Where-Object { $_.Label -eq "Volume Type" }

# This is a safety check to make sure that a value exists. For example, the value object may
# not exist on a field because the custom field was added after the entry already existed.
if ($null -eq $volumeTypeField.Value) {
  $volumeTypeField.Value = @{}
}

# Here, we update the 'ValueAsString' property of the value because our custom field is a text-
# based field. If this was a whole number, you would use 'ValueAsNumber', a decimal would be
# 'ValueAsDecimal', a yes/no field would be 'ValueAsBoolean', and a date field would be 'ValueAsDate'
$volumeTypeField.Value.ValueAsString = "Produced to Opposing Counsel"

# We want to update a reference custom field named "Requesting Party" to "Ellena Connor <econnor@company.com>"
$requestingPartyField = $entry.Fields | Where-Object { $_.Label -eq "Requesting Party" }

if ($null -eq $requestingPartyField.Value) {
  $requestingPartyField.Value = @{}
}

if ($null -eq $requestingPartyField.Value.ReferenceObject) {
  $requestingPartyField.Value.ReferenceObject = @{}
}

$requestingPartyField.Value.ReferenceObject.Values = @(
  @{
    KeyAsInteger = 78
    Value = "Ellena Connor <econnor@company.com>"
  }
)

# Save the modified volume
$data = Set-Volume -Entry $entry

# Output some information to help indicate that the volume was updated
Write-Output "Volume $($data.VolumeId) ($($data.Name)) was updated"

# For debug purposes, convert the data to output as JSON so we can see all the fields
Write-Output ""
Write-Output "JSON Results:"

$jsonOutput = $data | ConvertTo-Json -Depth 10

# Output the data
Write-Output $jsonOutput

Execution results:

Volume 41 (AGM003) was updated

JSON Results:
{
  "VolumeId": 41,
  "ProjectId": 2016100000006,
  "Project": null,
  "ProjectDescription": "Load Data",
  "Name": "AGM003",
  "TaskId": 284,
  "Task": null,
  "TaskName": "Process and Load Data",
  "MatterId": 51,
  "Matter": null,
  "MatterName": "AGM Widget v. XYZ Sprocket",
  "MatterReference": "0002",
  "ClientId": 29,
  "Client": null,
  "ClientName": "AGM Widget Corporation",
  "ClientReference": "1024",
  "DocCount": 1000,
  "PageCount": 0,
  "NativeCount": 1000,
  "Notes": "Was previously collected from vault 3 and removed for processing.",
  "VolumeRangeBeg": null,
  "VolumeRangeEnd": null,
  "NumberOfVolumeRanges": 0,
  "VolumeDate": "2024-04-18T13:15:39.4525183+00:00",
  "VolumeRanges": [],
  "BatesRanges": [],
  "Fields": [
    {
      "FieldId": 77,
      "ObjectId": 4,
      "DataTypeId": 8,
      "DataTypeName": "Single Choice",
      "Label": "Volume Type",
      "IsRequired": false,
      "Position": 0,
      "Guid": 8232606313213,
      "IsSystemField": false,
      "IsReferenceValue": false,
      "DefaultValue": "Processing Volume\nProduced From Opposing Counsel\nProduced To Opposing Counsel",
      "CopyPreviousValueOnSaveAndNew": false,
      "Value": {
        "ObjectFieldValueId": 2185,
        "ObjectFieldId": 77,
        "ObjectId": 4,
        "PrimaryKeyId": 41,
        "ValueAsString": "Produced to Opposing Counsel",
        "ValueAsBoolean": null,
        "ValueAsNumber": null,
        "ValueAsDecimal": null,
        "ValueAsDate": null,
        "ReferenceObject": null
      },
      "ReferenceObject": null
    },
    {
      "FieldId": 78,
      "ObjectId": 4,
      "DataTypeId": 10,
      "DataTypeName": "Reference",
      "Label": "Requesting Party",
      "IsRequired": false,
      "Position": 1,
      "Guid": 7456561091592,
      "IsSystemField": false,
      "IsReferenceValue": false,
      "DefaultValue": null,
      "CopyPreviousValueOnSaveAndNew": false,
      "Value": {
        "ObjectFieldValueId": 2186,
        "ObjectFieldId": 78,
        "ObjectId": 4,
        "PrimaryKeyId": 41,
        "ValueAsString": null,
        "ValueAsBoolean": null,
        "ValueAsNumber": null,
        "ValueAsDecimal": null,
        "ValueAsDate": null,
        "ReferenceObject": {
          "ObjectFieldReferenceObjectInstanceId": 330,
          "ObjectFieldValueId": 2186,
          "ObjectId": 7,
          "Object": null,
          "PrimaryObjectId": 4,
          "PrimaryKeyId": 41,
          "KeyType": "Int32",
          "DisplayFormat": "%Val%",
          "IsSystemObject": true,
          "Name": null,
          "NumberOfValues": 1,
          "Values": [
            {
              "ObjectFieldReferenceObjectInstanceValueId": 250,
              "ObjectFieldReferenceObjectInstanceId": 330,
              "KeyAsString": null,
              "KeyAsInteger": 78,
              "KeyAsLong": null,
              "Value": "Ellena Connor <econnor@company.com>"
            }
          ]
        }
      },
      "ReferenceObject": null
    }
  ],
  "CreatedByFullName": "Max Miller",
  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "CreatedOn": "2024-04-18T13:15:39.6471961+00:00",
  "CreatedBy": null,
  "LastUpdatedByFullName": "Max Miller",
  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "LastUpdatedOn": "2024-04-18T13:22:12.1527986+00:00",
  "LastUpdatedBy": null,
  "IsFavorite": false
}

What's Next