RenameObject
You can use the RenameObject function to assign a new name to an Optiva object. For version-based objects, such as Formula, Specification, and Label Content, you can also modify the version of the object key.
When to use
You can use this function to:
- Rename objects with new identifiers.
- Update versions for version-supported objects.
When not to use
You cannot use this function when creating a copy with a new name. Use ObjectSaveAs instead.
Syntax
long RenameObject(string objSymbol, string objKey, string newObjKey)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| objSymbol | string | Yes |
The symbol of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| objKey | string | Yes |
The key of the object.
Note: You can use empty quotation marks ("") for the current workflow symbol.
|
| newObjKey | string | Yes | The new object key/name to assign. For versioned objects, include version separator. For example, "NAME\VERSION". |
Return Value
The application returns a value greater than zero (0) if the operation is successful.
Impact
- The object is accessible only through the new name. The old name is no longer valid.
- The application updates all standard internal references to the object. For example, if the object is used in an extension field or table, the code is not updated.
Prerequisites
- The new object key must be unique. Duplicate names are not permitted.
- For version-based objects, use the format "NAME\VERSION", such as "LOWFAT\0001".
- For non-versioned objects, use a simple name, such as "BREAD".
Examples
- Example 1
-
Rename specification with version.
RenameObject("SPECIFICATION", "FAT\0001","LOWFAT\0001");
- Example 2
-
Rename non-versioned item.
RenameObject("ITEM", "GARLIC", "BREAD");