Scripting functions for IDM wizard attachments

GetWizardAttachments, SetWizardAttachmentsToObject, AddAttachmentstoObject, AddAttachmentCopytoObject and AddSpecificAttachmenttoObject are the functions used for IDM wizard attachments.

These functions are written in the FSLIBIDMHELPER Script Library.

Use the GetWizardAttachments function to get the attachments based upon the WIPID and Object Symbol. Then, use the SetWizardAttachmentsToObject function to set those attachments to the Object.

GetWizardAttachments

This function returns the Attachments(CMItems) for a particular Object Symbol. Workflow ID and Object Symbol are inputs to the function.

Dim idmHelper as new FsLibIDMHelper(me)
Dim attachments As CMItems = idmHelper.GetWizardAttachments( wipID  
,ObjectSymbol )
Input Parameter Description
wipID The Workflow ID of wizard where the document are attached to.
objSymbol

The Optiva Object Symbol to retrieve IDM Documents from.

For example, the symbol for the source object can be a Formula or an Item.

SetWizardAttachmentsToObject

This function sets the attachments to the Object. You can pass a single attachment or multiple attachments to the function. You can even modify Attachments(CMItems) and pass the modified attachments to the function.

Workflow ID, Object Symbol, Object Code and Attachments (CMItems) are inputs to the function.

Dim status As Integer = idmHelper.SetWizardAttachmentsToObject( wipID  ,ObjectSymbol, ObjectCode , attachments )
Input Parameter Description
wipID Workflow Id of the wizard that documents are attached to.
objSymbol

The Optiva Object Symbol to attach the Documents (CMItems) to.

For example, the symbol for the source object can be a Formula or an Item.

objKey

The Optiva Object to attach the Documents (CMItems) to.

For example, ITEM001 or FORMULA1\0001.

cmItems The attachments (CMItems) received from the GetWizardAttachments function and to attach to the target symbol.

AddAttachmentstoObject

This function adds all attachments from the Wizard to the business object.

Public Function AddAttachmentstoObject(wipID  as String, ByVal sObjectSymbol as String, ByVal sObjectCode as String)
Part Type Description
wipID String Workflows in Progress ID.
sObjectSymbol String Optiva object symbol that the IDM attachment will be attached to.
sObjectCode String Optiva object code that the IDM attachment will be attached to.

This example adds all IDM attachments from the Wizard to a business object.

Public Function AddAttachmentstoObject(wipID  as String, ByVal sObjectSymbol as String, ByVal sObjectCode as String)
Dim idmHelper as new FsLibIDMHelper(me)
Dim attachments As CMItems = idmHelper.GetWizardAttachments(wipID  ,sObjectSymbol)
Dim rc As Integer = idmHelper.SetWizardAttachmentsToObject(wipID  ,sObjectSymbol, sObjectCode , attachments )
return rc
End Function

AddAttachmentCopytoObject

This function copies IDM attachments and attaches the new attachment to a business object.

Public Function AddAttachmentCopytoObject(wipID  as String, ByVal sObjectSymbol as String, ByVal sObjectCode as String)
Part Type Description
wipID String Workflows in Progress ID.
sObjectSymbol String Optiva object symbol that the IDM attachment will be attached to.
sObjectCode String Optiva object code that the IDM attachment will be attached to.

This example shows the item (CMItem) is copied and MakeItemCopy copies the attachment before the copy of the new attachment is attached to the business object. The method is used to attach the same document to multiple objects. You can copy the document to pass it to the SetWizardAttachmentsToObject method.

Public Function AddAttachmentCopytoObject(wipID  as String, ByVal sObjectSymbol as String, ByVal sObjectCode as String)
Dim idmHelper as new FsLibIDMHelper(me)
Dim CopiedItem As CMItem
Dim attachments As CmItems =  idmHelper.GetWizardAttachments(wipID  ,sObjectSymbol)
CopiedItem = idmHelper.MakeItemCopy(attachments(0))
Dim rc As Integer =  idmHelper.SetWizardAttachmentsToObject(wipID  ,sObjectSymbol, sObjectCode , CopiedItem )
return rc
End Function
End Class

AddSpecificAttachmenttoObject

This function adds specific IDM attachments from the Wizard to a business object.

Public Function AddSpecificAttachmenttoObject(wipID  as String, ByVal sObjectSymbol as String, ByVal sObjectCode as String)
Part Type Description
wipID String Workflows in Progress ID.
sObjectSymbol String Optiva object symbol that the IDM attachment will be attached to.
sObjectCode String Optiva object code that the IDM attachment will be attached to.

This example shows how a specific attachment (attachments(0)) is first attached (CMItems) to the business object. This method is used to add only one attachment from the list of attachments.

Public Function AddSpecificAttachmenttoObject(wipID  as String, ByVal sObjectSymbol as String, ByVal sObjectCode as String)
Dim idmHelper as new FsLibIDMHelper(me)
Dim attachments As CMItems
attachments = idmHelper.GetWizardAttachments(wipID  ,sObjectSymbol)
Dim rc As Integer = idmHelper.SetWizardAttachmentsToObject(wipID  ,sObjectSymbol, sObjectCode , attachments(0))
return rc
End Function