RemoveDocuments
You can use the RemoveDocuments function in Optiva Workflows and Copy Methods to remove all document attachments and document text from an object.
This function removes document attachments and text entries from Optiva objects, with the option to exclude specific function codes from removal. It is useful for cleaning up documents during copy operations or workflow processes.
When to use
You can use this function to:
- Remove documents from copied objects to create a clean documentation slate or remove source-specific documents.
- Remove unnecessary document attachments while preserving critical documents through an exclusion list.
When not to use
You cannot use this function when all documents need to be retained.
Note: Use cleanup if required.
Syntax
int RemoveDocuments(string objSymbol, string objkey, params string[] funcCodes);
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.
|
| funcCodes | Params string[] | Optional | The comma-delimited list of function codes from which document attachments should NOT be removed. |
Exclusion working
- Without funcCodes: Removes ALL documents from ALL function codes
- With funcCodes: Removes ALL documents EXCEPT those in the specified function codes
Return Value
The application returns a value greater than zero (0) if the operation is successful.
Impact
The document is removed permanently and cannot be undone.
Prerequisites
- The excluded function codes must be valid in the system.
- The function removes both document attachments and text entries for the affected function codes.
Examples
- Example 1
-
Remove All Document Attachments from Specific Formula.
int iRemove; RemoveDocuments("FORMULA", "PIZZA_SAUCE\\003");
- Description
- In this example, all of the document attachments in the PIZZA_SAUCE\003 formula are removed.
- Example 2
-
Remove Documents Except Specified Function Codes.
int iRemove; RemoveDocuments("FORMULA", "PIZZA_SAUCE\\003", "INSTRUC", "SAFETY");
- Description
- You can remove all document attachments from the PIZZA_SAUCE\003 formula, except instructions and attachments to the safety function code. To do so, specify INSTRUC and SAFETY as excluded function codes.
- Example 3
-
Remove All Documents from Current Workflow or New Object.
int iRemove = RemoveDocuments("", "");
- Description
- In this example, all of the document attachments are removed from the workflow or newly-created object.