Add-MediaLogEntry
  • 4 Minutes to read
  • Dark
    Light
  • PDF

Add-MediaLogEntry

  • Dark
    Light
  • PDF

Article summary

Summary

Creates a new media log entry.

Add-MediaLogEntry
    -Entry
    -BypassCustomFieldValidation

Returns a media log entry object.

Parameters

ParameterTypeRequired?Notes
EntryMedia Log Entry ObjectYes
BypassFieldValidationSwitchNo, Defaults to falseIgnores required field requirement for custom fields when the entry is saved.

Examples

Create a new media log entry (no custom fields)

# Create a new media log entry (no custom fields)

# Create an object with the necessary fields to create the media log entry
# Note: Required fields:
#       * MediaTypeId

# Note: To reference a media log entry with a client, set the ClientId property
#       To reference a media log entry with a matter, set the MatterId property
#       To reference a media log entry with a project, set the ProjectId property
#       To reference a media log entry with a task, set the TaskId property

$entry = @{
    MediaTypeId = 9
    MatterId    = 8
    Location    = "MN"
    From        = "Trisha A."
    To          = "Mark S."
}

# Create the media log entry. The created entry will be returned back.
$data = Add-MediaLogEntry -Entry $entry

# Output some information to help indicate that the media log entry was created
Write-Output "Media log entry $($data.MediaLogEntryId) ($($data.MediaTypeName)) was created"

# 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:

Media log entry 56 (Computer) was created

JSON Results:
{
  "MediaLogEntryId": 56,
  "MediaTypeId": 9,
  "MediaTypeName": "Computer",
  "ProjectId": null,
  "Project": null,
  "ProjectDescription": null,
  "TaskId": null,
  "Task": null,
  "TaskName": null,
  "ClientId": 5,
  "Client": null,
  "ClientName": "Gamma Tech",
  "ClientReference": "5001",
  "MatterId": 8,
  "Matter": null,
  "MatterName": "Gamma Tech v. Zhonghua Mfg.Group",
  "MatterReference": "ABC000",
  "Reference": null,
  "Location": "MN",
  "Custodian": null,
  "Notes": null,
  "From": "Trisha A.",
  "To": "Mark S.",
  "Date": "2024-04-18T11:45:13.4578475+00:00",
  "Fields": [
    {
      "FieldId": 23,
      "ObjectId": 3,
      "DataTypeId": 8,
      "DataTypeName": "Single Choice",
      "Label": "Media Status",
      "IsRequired": false,
      "Position": 0,
      "Guid": 1500309138663,
      "IsSystemField": false,
      "IsReferenceValue": false,
      "DefaultValue": "In Storage\nReturned \nDestroyed",
      "CopyPreviousValueOnSaveAndNew": false,
      "Value": null,
      "ReferenceObject": null
    },
    {
      "FieldId": 76,
      "ObjectId": 3,
      "DataTypeId": 10,
      "DataTypeName": "Reference",
      "Label": "Custodian",
      "IsRequired": false,
      "Position": 1,
      "Guid": 8744623462400,
      "IsSystemField": false,
      "IsReferenceValue": false,
      "DefaultValue": null,
      "CopyPreviousValueOnSaveAndNew": false,
      "Value": null,
      "ReferenceObject": null
    }
  ],
  "CreatedByFullName": "Max Miller",
  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "CreatedOn": "2024-04-18T11:45:13.5965161+00:00",
  "CreatedBy": null,
  "LastUpdatedByFullName": "Max Miller",
  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "LastUpdatedOn": "2024-04-18T11:45:13.5965161+00:00",
  "LastUpdatedBy": null
}

Create a new media log entry (with custom fields)

# Create a new media log entry (with custom fields)

# Create an object with the necessary fields to create the media log entry
# Note: Required fields:
#       * MediaTypeId

# Note: To reference a media log entry with a client, set the ClientId property
#       To reference a media log entry with a matter, set the MatterId property
#       To reference a media log entry with a project, set the ProjectId property
#       To reference a media log entry with a task, set the TaskId property

$entry = @{
    MediaTypeId = 9
    MatterId    = 8
    Location    = "MN"
    From        = "Trisha A."
    To          = "Mark S."
    Fields      = @(
        @{
            FieldId = 23
            Label   = "Media Status"
            Value   = @{
                ValueAsString = "In Storage"
            }
        }
        @{
            FieldId = 76
            Label   = "Custodian"
            Value   = @{
                ReferenceObject = @{
                    Values  = @(
                        @{
                            KeyAsInteger    = 5
                            Value           = "Gene Anderson"
                        }
                    )
                }
            }
        }
    )
}

# Create the media log entry. The created entry will be returned back.
$data = Add-MediaLogEntry -Entry $entry

# Output some information to help indicate that the media log entry was created
Write-Output "Media log entry $($data.MediaLogEntryId) ($($data.MediaTypeName)) was created"

# 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:

Media log entry 57 (Computer) was created

JSON Results:
{
  "MediaLogEntryId": 57,
  "MediaTypeId": 9,
  "MediaTypeName": "Computer",
  "ProjectId": null,
  "Project": null,
  "ProjectDescription": null,
  "TaskId": null,
  "Task": null,
  "TaskName": null,
  "ClientId": 5,
  "Client": null,
  "ClientName": "Gamma Tech",
  "ClientReference": "5001",
  "MatterId": 8,
  "Matter": null,
  "MatterName": "Gamma Tech v. Zhonghua Mfg.Group",
  "MatterReference": "ABC000",
  "Reference": null,
  "Location": "MN",
  "Custodian": null,
  "Notes": null,
  "From": "Trisha A.",
  "To": "Mark S.",
  "Date": "2024-04-18T11:53:25.4510619+00:00",
  "Fields": [
    {
      "FieldId": 23,
      "ObjectId": 3,
      "DataTypeId": 8,
      "DataTypeName": "Single Choice",
      "Label": "Media Status",
      "IsRequired": false,
      "Position": 0,
      "Guid": 1500309138663,
      "IsSystemField": false,
      "IsReferenceValue": false,
      "DefaultValue": "In Storage\nReturned \nDestroyed",
      "CopyPreviousValueOnSaveAndNew": false,
      "Value": {
        "ObjectFieldValueId": 2181,
        "ObjectFieldId": 23,
        "ObjectId": 3,
        "PrimaryKeyId": 57,
        "ValueAsString": "In Storage",
        "ValueAsBoolean": null,
        "ValueAsNumber": null,
        "ValueAsDecimal": null,
        "ValueAsDate": null,
        "ReferenceObject": null
      },
      "ReferenceObject": null
    },
    {
      "FieldId": 76,
      "ObjectId": 3,
      "DataTypeId": 10,
      "DataTypeName": "Reference",
      "Label": "Custodian",
      "IsRequired": false,
      "Position": 1,
      "Guid": 8744623462400,
      "IsSystemField": false,
      "IsReferenceValue": false,
      "DefaultValue": null,
      "CopyPreviousValueOnSaveAndNew": false,
      "Value": {
        "ObjectFieldValueId": 2182,
        "ObjectFieldId": 76,
        "ObjectId": 3,
        "PrimaryKeyId": 57,
        "ValueAsString": null,
        "ValueAsBoolean": null,
        "ValueAsNumber": null,
        "ValueAsDecimal": null,
        "ValueAsDate": null,
        "ReferenceObject": {
          "ObjectFieldReferenceObjectInstanceId": 328,
          "ObjectFieldValueId": 2182,
          "ObjectId": 14,
          "Object": null,
          "PrimaryObjectId": 3,
          "PrimaryKeyId": 57,
          "KeyType": "Int32",
          "DisplayFormat": "%Name%",
          "IsSystemObject": false,
          "Name": null,
          "NumberOfValues": 1,
          "Values": [
            {
              "ObjectFieldReferenceObjectInstanceValueId": 246,
              "ObjectFieldReferenceObjectInstanceId": 328,
              "KeyAsString": null,
              "KeyAsInteger": 5,
              "KeyAsLong": null,
              "Value": "Gene Anderson"
            }
          ]
        }
      },
      "ReferenceObject": null
    }
  ],
  "CreatedByFullName": "Max Miller",
  "CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "CreatedOn": "2024-04-18T11:53:25.6034461+00:00",
  "CreatedBy": null,
  "LastUpdatedByFullName": "Max Miller",
  "LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
  "LastUpdatedOn": "2024-04-18T11:53:25.6034461+00:00",
  "LastUpdatedBy": null
}