# Directives

MERGE OBJECT | Merge Existing Objects

## Formats

Merge Object Properties/Methods: | MERGE OBJECT object_to_extend WITH object_to_merge

Where:

object_to_extend | This object will be extended as a result of the merge operation.
object_to_merge | This object contains the properties/methods that will be logically merged into object_to_extend.

## Description

The MERGE OBJECT directive logically merges the properties/methods of two objects. All properties and methods in the object_to_merge will be logically added to the object_to_extend. Both objects must exist in the system. The system will reject any attempt to create a loop within the merged object list. For example, if object 1 is merged with object 2, which in turn is merged with object 3, attempting to merge object 3 with either 1 or 2 will result in an error.

Typical uses would be to merge or join two objects, such as an invoice header and invoice detail, so that the resultant object has the properties from both. Each invoice detail line object could merge itself with its respective parent invoice header, making all the properties of the header available while accessing the detail.

Objects can have only one object that they are merged with; however, an object can have any number of objects that are merged with it.