IBProcessEmailDocuments.AddNewDocument

Syntax

AddNewDocument(Value: IMetabaseObjectDescriptor);

Parameters

Value. Description of the repository object that is a document that supports the IDocument interface.

Description

The AddNewDocument method adds a document from the repository to the end of the collection.

Example

Executing the example requires that the repository contains a process with the PROCESS identifier and a document with the F_HELP identifier. An event that occurs during process startup is setup in the process.

Add links to the BPM, Metabase system assemblies. Add a link to the assembly that is required to work with processes.

Sub UserProc;
Var
    Mb: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Process: IBProcess;
    EventCollection: IBProcessEventGroupCollection;
    EventGroup: IBProcessEventGroup;
    EmailEvent: IBProcessEventEmail;
    Docs: IBProcessEmailDocuments;
Begin
    Mb := MetabaseClass.Active;
    MObj := Mb.ItemById("PROCESS");
    // Get process structure
    Process := BProcessCollection.EditByKey(MObj.Key);
    // Get the collection of groups of process events
    EventCollection := Process.Events;
    // Get group of events that occur during process startup
    EventGroup := EventCollection.ItemByType(BProcessEventType.StartProcess);
    EmailEvent := EventGroup.Item(0As IBProcessEventEmail;
    // Documents attached to email
    Docs := EmailEvent.Email.Documents;
    Docs.AddNewDocument(Mb.ItemById("F_HELP"));
    // Save changes
    If EmailEvent.IsValid Then
        Process.Save;
    End If;
End Sub UserProc;

After executing the example settings of the event that occurs during process startup are changed, that is, a repository document is attached to the event.

See also:

IBProcessEmailDocuments