CopyRefObjReferences
You can use the CopyRefObjReferences function to copy references from a reference object to a newly created object for designated object types. This function enables selective copying of specific reference types or all references, but the reference configurations must exist for both the source and target object types.
When to use
You can use this function when creating objects from the References tab that require reference relationships from the reference object.
When not to use
You cannot use this function when:
- The reference types are not configured for the target object type.
- Outside of copy method workflows (function requires specific context setup).
Syntax
long CopyRefObjReferences(); long CopyRefObjReferences(params string[] @params);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| @params | string | Optional |
Specifies a variable-length array of object type codes for the references to copy.
Note: If omitted or empty, all the references from the reference object are copied.
|
Return Value
The application returns a value greater than zero (0) if the operation is successful.
Prerequisites
- The function must be executed within a valid copy method workflow context.
- The referenced entities must exist and be accessible.
Examples
- Example 1
-
Copy Specific Reference Types
CopyRefObjReferences("PROJECT", "CUSTOMER");
- Description
- This script is in a copy method for a specification created from the References tab of a formula (Object Type = SPECIFICATION, Reference Type = FORMULA, Events = Create From As New). It copies PROJECT and CUSTOMER references from the formula to the specification.
- Example 2
-
Copy All References
CopyRefObjReferences();
- Description
- This script is in a copy method for a specification created from the References tab of a formula (Object Type = SPECIFICATION, Reference Type = FORMULA, Events = Create From As New). It copies all references from the formula to the specification.