Topic
This article explains how to use Ninja-Property-Docs-Set-Single to set the value of a specified custom field in a single document.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Ninja-Property-Docs-Set-Single cmdlet sets the value of a specified custom field in a single document. You can specify the field name using the -AttributeName parameter, the document template using the -TemplateName parameter, and the value to set using the -AttributeValue parameter. The cmdlet updates the value of the specified custom field in the single document associated with the specified template.
Only fields with automation write permissions can be updated using this cmdlet. The device executing this cmdlet must be assigned as a documentation delegate for the document containing the custom field to be updated. The specified custom field in the document is updated after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes.
Syntax
Ninja-Property-Docs-Set-Single [[-TemplateName] <Object>] [[-AttributeName] <Object>] [[-AttributeValue] <Object>] [<CommonParameters>]
Example
Setting a Custom Field Value in a Single Document
PS C:> Ninja-Property-Docs-Set-Single -TemplateName "My Example Document" -
AttributeName "exampleTextField" -AttributeValue "New Value"The specified custom field in the document is updated to "New Value" after the next
successful sync with the NinjaOne platform, which typically occurs within a few minutes.
Parameters
-AttributeName
Specify the name of the custom field for which you want to set a value.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-AttributeValue
Define the value you want to set for the specified custom field. The value provided should be compatible with the type of the custom field being updated (e.g., text, dropdown, multi-select)
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-TemplateName
Enter the name of the document template associated with the single document containing the custom field you want to set.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseInputs
System.String
This cmdlet does not accept input from the pipeline. The -TemplateName , -AttributeName ,and -AttributeValue parameters accept string values representing the name of thedocument template, the name of the custom field, and the value to set for the custom field, respectively.
Outputs
None
- The device executing this cmdlet must be assigned as a documentation delegate for the
document containing the custom field to be updated. - Only fields with automation write permissions can be updated using this cmdlet. For information about permissions for custom fields refer to NinjaOne Custom Fields: Getting Started.
- The specified custom field in the document is updated after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes.
Additional Resources
For more information about asset management and custom scripting, refer to the following resources: