RemoveReferences

You can use the RemoveReferences function to remove some or all references from the References tab of an object. The function enables removing references by type and code or removing all references from an object.

When to use

You can use this function to:

  • Remove specific reference relationships from objects.
  • Remove all references of a specific type, such as VENDOR.
  • Implement business rules that remove references conditionally.

When not to use

You cannot use this function when only Reference Code or Reference Status Code metadata needs to be cleared. Use RemoveRefCodes instead

Syntax

long RemoveReferences(string objSymbol, string objectKey, string type = null, string code = null)

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.
type string No The reference type to remove. For example, "VENDOR", "SPECIFICATION", "LABELCONTENT", "PROJECT".
Note: If null or empty, all references regardless of type are removed.
code string No Specific reference code to remove.
Note: 
  • If provided, removes only the reference matching this code of the specified type.
  • If empty,all the references of the specified type are removed.

Return Value

The application returns zero (0) if the operation is successful.

Impact

  • The application permanently removes reference relationships from the References tab.
  • The referenced objects no longer are displayed on the References tab.
  • The operation cannot be undone.
  • The changes are immediately persisted to the database.

Example

Example 1
Removes the VENDOR references from the current object.
RemoveReferences("", "", "VENDOR");
Description

All of the VENDOR references are removed from the current object upon which the workflow is launched.

Example 2
Removes the SPECIFICATION references from the current object.
RemoveReferences("", "", "SPECIFICATION");
Description
All the specification references are removed from the current object upon which the workflow is launched.
Example 3
All the references from PIZZA_SAUCE\0001 formula are removed.
RemoveReferences("FORMULA", "PIZZA_SAUCE\0001");
Example 4
The Label Content reference LC0001\0001 is removed from PIZZA_SAUCE\0001 formula.
RemoveReferences("FORMULA", "PIZZA_SAUCE\0001", "LABELCONTENT", "LC0001\0001");