Document Release Transition onEvent Method

Here is an example of a server method to request replication for file(s) attached to a document which is transitioning to Released state. It would be specified as the Post Server Method on the transition(s) to Released state on the document’s Lifecycle Map.

Dim inn As Innovator = Me.getInnovator()

Dim thisDoc As String = Me.getID()

Dim innrep, innresult As Item

Dim myQry As Item = Me.newItem("Document File","get")

myQry.setProperty("source_id", thisDoc)

myQry.setAttribute("select","related_id")

Dim results As Item = myQry.apply()

Dim docfiles As Item = results.getItemsByXPath("//Item[@type='Document File']")

Dim w As Integer = 0

For w=0 To DocFiles.getItemCount()-1

    Dim DocFile As Item = DocFiles.getItemByIndex(w)

    Dim FileId As String = DocFile.getProperty("related_id")

    innrep = inn.newItem("File","replicate")

    innrep.setId(FileId)

    innresult = innrep.apply()

Next w

Return Me