Click or drag to resize

IScriptingEventsOnCurrentContactCreated Method

Called when a new object is saved for the first time.

Namespace:  SuperOffice.COM.ScriptEvents
Assembly:  Scripting.Interop (in Scripting.Interop.dll) Version: 8.0.0.0
Syntax
void OnCurrentContactCreated()
Examples

Description

This text may be copied to the notepad, and saved as a *.vbs file.

VB
Sub OnCurrentContactCreated
        'if contact.name = Lastname, Firstname
        'and Category = B2C (Business to consumer),
        'then this will create a person on this company
        Position = InStr(1, CurrentContact.Name, ", ")

        Set cat = Database.GetListItemByName(64, "B2C")

        If CurrentContact.Category.Id = cat.Id Then
            Set soPers = CurrentPerson
            soPers.SetDefaults
            soPers.MrMrs = ""
            soPers.LastName = Trim(Left(CurrentContact.Name, Position - 1))
            soPers.FirstName = Trim(Right(CurrentContact.Name, Len(CurrentContact.Name) - Position))
            soPers.Save
        End If

End Sub

See Also