Topic
This article explains how to use Ninja-Property-Docs-Clear to clear the value of a specified custom field in a document
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Ninja-Property-Docs-Clear cmdlet clears 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, and the document template using the - TemplateId parameter. The cmdlet will remove any existing value from the custom field, effectively resetting it to an empty state.
Only fields with automation write permissions can be reset using this cmdlet. The custom field value will be cleared after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes. The device executing this cmdlet must be assigned as
a documentation delegate for the document containing the custom field to be cleared.
Syntax
Ninja-Property-Docs-Clear [[-TemplateId] <Object>] [[-DocumentName] <Object>] [[-AttributeName] <Object>] [<CommonParameters>]
The text field is cleared after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes.
Examples
Example 1: Clear a Custom Field in a Document
PS C:> Ninja-Property-Docs-Clear -TemplateId "12345" -DocumentName "My
Example Document" -AttributeName "exampleAttribute"The specified custom field in the document is cleared 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 you want to clear in the document.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
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 clear.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-TemplateId
Specify the ID of the document template containing the document and custom field you want
to clear.
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 -AttributeName , -DocumentName , and -TemplateId parameters accept string values representing the name of the custom field to clear, the name of the document, and the ID of the document template, respectively.
Outputs
System.Object
- The device executing this cmdlet must be assigned as a documentation delegate for the document containing the custom field to be cleared.
- Automation write permissions are required to clear any custom field value. For information about permissions for custom fields refer to NinjaOne Custom Fields: Getting Started.
- The custom field value will be cleared 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: