Topic
This article explains how to use Ninja-Property-Docs-Setto set the value of a specified custom field in a document.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Ninja-Property-Docs-Set cmdlet sets the value of a specified custom field in a document. You can specify the field name using the -AttributeName parameter, the document using the -DocumentName parameter, the document template using the - TemplateId parameter, and the value to set using the -AttributeValue parameter. The cmdlet updates the value of the specified custom field in the 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 [[-TemplateId] <Object>] [[-DocumentName] <Object>] [[-AttributeName] <Object>] [[-AttributeValue] <Object>] [<CommonParameters>]
Example
Setting a Text Custom Field Value in a Document
PS C:> Ninja-Property-Docs-Set -TemplateId "12345" -DocumentName "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: 2
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, multiselect).
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-DocumentName
Specify the name of the document containing the custom field you want to set.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-TemplateId
Define the ID of the document template associated with the 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 -TemplateId , -DocumentName , -AttributeName , and -AttributeValue parameters accept string values representing the ID of the document template, the name of the document, 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: