Click or drag to resize

IScriptingEventsOnCurrentProjectBeforeSave Method

Called when Save has been triggered, but before anything is saved to the database.

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

Description

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

VB
Sub OnCurrentProjectBeforeSave
' requires a userdefined field named 
' "Next service" as date and
' "Technician" as associate list defined on project

'If this is a new project, then set Next service
if Currentproject.identity = 0 then
    set cont = Currentproject
    set udefs = cont.udef

    For Each udef In udefs
    'Ser next service to three months from today
        If udef.label = "Next service" Then udef.value = DateAdd("m", 3, Now())
    If udef.label = "Technician" then udef.value = 2 'associate with associate_id=2
    Next
end if
End Sub

See Also