Click or drag to resize

IDatabaseCreateRelation Method

Create a blank Relation object. Use the Save() method to persist the object to the database.

Namespace:  SuperOffice.COM.SuperOfficeDB
Assembly:  SuperOfficeDB.Interop (in SuperOfficeDB.Interop.dll) Version: 8.0.0.0
Syntax
SORelation CreateRelation()

Return Value

Type: SORelation
SORelation – a new SORelation object
Examples

Create a new relation

This text may be copied to the notepad, and saved as a *.vbs file. You need a running CRM 5 to make it work. (This example uses the SuperOffice COM application library and not the SuperOffice db library interface).

VB
dim objso
set objso  = CreateObject("superoffice.application")
If not (objSO is nothing) Then
    set newrelation = objso.database.createrelation
    'set  company with contact_id=1 to target
    newrelation.targetrecord = objso.database.getcontact(3)
    'set company with contact_id=2 as  source
    newrelation.sourcerecord = objso.database.getcontact(2)
    'set a type of relation, this will by default be: owns -  owned by
    newrelation.type = 1
    'add  a comment to the created relation
    newrelation.comment = "relation created with supercom."
    'save it to the database
    newrelation.save
    'set context to the relation panel of the target company.
    objso.setcontext 1,0,13
else
    msgbox "unable to connect to database"
end if

See Also