file.NameConflictResolution

Note:

The content in this help topic pertains to SuiteScript 2.0.

Enum Description

Holds the string values for supported conflict resolution types.

Use the values in this enum to specify how to resolve conflicts when copying files. A conflict occurs when the target folder for a copy operation already contains a file with the same name as the file to copy. When a conflict occurs, you can specify how the conflict is resolved. For example, the FAIL value indicates that the copy operation will fail if a conflict occurs.

This enum is used to set the value of the conflict resolution parameter in file.copy(options).

Note:

JavaScript does not include an enumeration type. The SuiteScript 2.0 documentation uses the term enumeration (or enum) to describe a plain JavaScript object with a flat, map-like structure. In this object, each key points to a read-only string value.

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Module

N/file Module

Since

2021.1

Values

Value

Description

FAIL

Fail with an error if a conflict occurs.

OVERWRITE

Overwrite the existing file if a conflict occurs. Attributes and permissions of the overwritten file are preserved (meaning that the copied file has the same attributes and permissions as the file that was overwritten).

OVERWRITE_CONTENT_AND_ATTRIBUTES

Overwrite the existing file if a conflict occurs. Attributes and permissions are also overwritten.

RENAME_TO_UNIQUE

Add a numeric suffix to the name of the copied file if a conflict occurs. For example, if you are copying a file named file.txt and a conflict occurs, the name of the copied file is file (1).txt.

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/file Module Script Samples.

          // Add additional code 
...
var fileObj = file.copy({
    id: 123,
    folder: 456,
    conflictResolution: file.NameConflictResolution.OVERWRITE
});
...
 // Add additional code 

        

Related Topics

N/file Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices