CopyRefObjIngreds

You can use the CopyRefObjIngreds function to copy ingredients and their values from a reference object to a newly created object. The function is designed for copy methods that create objects from the References tab.

It enables the new object to inherit the complete ingredients and its values from its parent reference object.

When to use

You can use this function when implementing copy methods for objects created from the References tab.

When not to use

You cannot use this function when:

  • You need to copy only specific ingredients.
  • Outside of copy method workflows (function requires specific context setup).

Syntax

long CopyRefObjIngreds();

Parameters

This function does not have parameters. It uses the current copy operation context to identify the

  • The reference (parent) object from which to copy ingredients.
  • The target (new) object to which ingredients will be copied.

Return Value

The application returns a value greater than zero (0) if the operation successful.

Prerequisites

This function must be executed within a valid copy method workflow context.

Examples

Example 1
long ingred = CopyRefObjIngreds();
Usage

This script is in a copy method for a specification that is created from the References tab of a formula (Object Type = SPECIFICATION, Reference Type = FORMULA, Events = Create From As New). It adds all of the formula ingredients, with or without a value, to the specification.