Set-Matter
- 4 Minutes to read
- Print
- DarkLight
- PDF
Set-Matter
- 4 Minutes to read
- Print
- DarkLight
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Summary
Updates an existing matter.
Set-Matter
-Entry
-BypassCustomFieldValidation
Returns a matter object.
Parameters
Parameter | Type | Required? | Notes |
---|---|---|---|
Entry | Matter Object | Yes | |
BypassCustomFieldValidation | Switch | No, Defaults to false | Ignores required field requirement for custom fields when the entry is saved. |
Examples
Update an existing matter
# Update an existing matter
# 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-Matter -Id 100
# In this example, we want to update a couple custom fields
# We want to update a yes/no custom field named "ESI Protocol Attached" to true
$esiProtocolAttachedField = $entry.Fields | Where-Object { $_.Label -eq "ESI Protocol Attached" }
# 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 $esiProtocolAttachedField.Value) {
$esiProtocolAttachedField.Value = @{}
}
$esiProtocolAttachedField.Value.ValueAsBoolean = $true
# We want to update a text custom field named "Team Color" to "Red"
$teamColorField = $entry.Fields | Where-Object { $_.Label -eq "Team Color" }
if ($null -eq $teamColorField.Value) {
$teamColorField.Value = @{}
}
$teamColorField.Value.ValueAsString = "Red"
# We want to update a reference custom field named "Skills" to "Analytics"
$skillsField = $entry.Fields | Where-Object { $_.Label -eq "Skills" }
if ($null -eq $skillsField.Value) {
$skillsField.Value = @{}
}
if ($null -eq $skillsField.Value.ReferenceObject) {
$skillsField.Value.ReferenceObject = @{}
}
$skillsField.Value.ReferenceObject.Values = @(
@{
KeyAsInteger = 2
Value = "Analytics"
}
)
# Save the modified matter
$data = Set-Matter -Entry $entry
# Output some information to help indicate that the matter was updated
Write-Output "Matter $($data.MatterId) 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:
Matter 100 was updated
JSON Results:
{
"MatterId": 100,
"Name": "Titan Contractors v Reliable Renovations",
"Reference": "TCRR001",
"Active": true,
"ClientId": 67,
"Client": null,
"ClientName": "QuantumTech v. CyberInnovate",
"ClientReference": "QT00001",
"DefaultContactId": null,
"DefaultContact": null,
"DefaultContactFullName": null,
"IsFavorite": false,
"NumberOfProjects": 0,
"NumberOfTasks": 0,
"NumberOfMediaLogEntries": 0,
"NumberOfVolumes": 0,
"NumberOfBillingEntries": 0,
"NumberOfComments": 0,
"FirstProjectCreatedOnDate": null,
"LastProjectCreatedOnDate": null,
"CreatedByFullName": "Max Miller",
"CreatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
"CreatedOn": "2024-04-17T13:08:50.8592386+00:00",
"CreatedBy": null,
"LastUpdatedByFullName": "Max Miller",
"LastUpdatedById": "25a34a2f-e3d8-4690-88f5-6b399cf88c4c",
"LastUpdatedOn": "2024-04-17T13:39:29.7958035+00:00",
"LastUpdatedBy": null,
"Fields": [
{
"FieldId": 19,
"ObjectId": 2,
"DataTypeId": 5,
"DataTypeName": "Yes or No Choice",
"Label": "ESI Protocol Attached",
"IsRequired": false,
"Position": 0,
"Guid": 1492029172604,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": "false",
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2170,
"ObjectFieldId": 19,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": null,
"ValueAsBoolean": true,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
},
{
"FieldId": 28,
"ObjectId": 2,
"DataTypeId": 2,
"DataTypeName": "Rich Text",
"Label": "Notes & Misc that can't fit in a single line",
"IsRequired": false,
"Position": 1,
"Guid": 1531229623985,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": null,
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2171,
"ObjectFieldId": 28,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": "<p>Matter opened up on 1/1/2024</p><p>Data collected on 2/1/2024</p>",
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
},
{
"FieldId": 29,
"ObjectId": 2,
"DataTypeId": 2,
"DataTypeName": "Rich Text",
"Label": "ESI Protocol",
"IsRequired": false,
"Position": 2,
"Guid": 1570803558740,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": null,
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2172,
"ObjectFieldId": 29,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": null,
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
},
{
"FieldId": 51,
"ObjectId": 2,
"DataTypeId": 8,
"DataTypeName": "Single Choice",
"Label": "Team Color",
"IsRequired": false,
"Position": 3,
"Guid": 8895432013021,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": "Red\nGreen\nBlue",
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2173,
"ObjectFieldId": 51,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": "Red",
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
},
{
"FieldId": 63,
"ObjectId": 2,
"DataTypeId": 10,
"DataTypeName": "Reference",
"Label": "Skills",
"IsRequired": false,
"Position": 4,
"Guid": 3294117251654,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": null,
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2174,
"ObjectFieldId": 63,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": null,
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": {
"ObjectFieldReferenceObjectInstanceId": 325,
"ObjectFieldValueId": 2174,
"ObjectId": 16,
"Object": null,
"PrimaryObjectId": 2,
"PrimaryKeyId": 100,
"KeyType": "Int32",
"DisplayFormat": "%Name%",
"IsSystemObject": false,
"Name": null,
"NumberOfValues": 1,
"Values": [
{
"ObjectFieldReferenceObjectInstanceValueId": 242,
"ObjectFieldReferenceObjectInstanceId": 325,
"KeyAsString": null,
"KeyAsInteger": 2,
"KeyAsLong": null,
"Value": "Analytics"
}
]
}
},
"ReferenceObject": null
},
{
"FieldId": 66,
"ObjectId": 2,
"DataTypeId": 4,
"DataTypeName": "Decimal Number",
"Label": "Total Billing Amount",
"IsRequired": false,
"Position": 5,
"Guid": 6886580921259,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": "0",
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2175,
"ObjectFieldId": 66,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": null,
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": 0.0000,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
},
{
"FieldId": 70,
"ObjectId": 2,
"DataTypeId": 1,
"DataTypeName": "Basic Text",
"Label": "Email Domains",
"IsRequired": false,
"Position": 6,
"Guid": 6721810143004,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": null,
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2176,
"ObjectFieldId": 70,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": "titancontractors.com",
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
},
{
"FieldId": 72,
"ObjectId": 2,
"DataTypeId": 1,
"DataTypeName": "Basic Text",
"Label": "Media Log Entry Prefix",
"IsRequired": false,
"Position": 7,
"Guid": 7749781040934,
"IsSystemField": false,
"IsReferenceValue": false,
"DefaultValue": null,
"CopyPreviousValueOnSaveAndNew": false,
"Value": {
"ObjectFieldValueId": 2177,
"ObjectFieldId": 72,
"ObjectId": 2,
"PrimaryKeyId": 100,
"ValueAsString": null,
"ValueAsBoolean": null,
"ValueAsNumber": null,
"ValueAsDecimal": null,
"ValueAsDate": null,
"ReferenceObject": null
},
"ReferenceObject": null
}
]
}