Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

GetActivityList on Sale

Hello, 

I am working on a vbscript (COM) that is looping through appointments connected to a sale.
I am using GetActivityList to fetch all activities, but it looks like I am unable to get the appoinment-variables..
This is the SDK-reference: 
https://community.superoffice.com/documentation/SDK/SO.COM.IApplication/html/T_SuperOffice_COM_Application_IActivityListItem.htm 

As sample is this:
I have an appointment in SuperOffice that is an activity: 

The code that is supposed to find this appointment and print out the Type is like this:

Set activityList = CurrentSale.GetActivityList(1)

For Each activityItem in activityList 
	SoMessageBox activityItem.Appointment.Task
Next

I already know the activity is an appointment (enAListAppointments = 1, so that is what im fetching with GetActivityList), so I just need to access the IAppointment to figure out what kind/Task it is. 

I am able to get other variables (for example activityItem.Associate.FullName), but I am also unable to get values from Sale.. 
This leads me to believe i need to do 'something' to get these entities, as they are rescribed like this in the SDK: 
Appointment - is NULL if inappropriate 
Document - is NULL if inappropriate
Sale - is NULL if inappropriate

How do i make them 'appropriate'? :P 

//Eivind
 

 

RE: GetActivityList on Sale

Look inside with a usefull vbscript debugger, I use VBSEdit:

..............

 

Task.Value( "recordtype" ) will contain one of the following enumerator:

 Enum EnAppointType

Const enAppointAllCounters = 10
Const enAppointAppoint = 1
Const enAppointDoc = 2
Const enAppointEmail = 3
Const enAppointFax = 4
Const enAppointMergeDraft = 7
Const enAppointMergeFinal = 8
Const enAppointPhone = 5
Const enAppointReport = 9
Const enAppointTodo = 6
Const enAppointUnknown = 0

 

Here is what I used to play with:

Set app = CreateObject( "SuperOffice.Application" )
If Not app Is Nothing Then
    Set db = app.Database

    Set sale = app.CurrentSale
    WScript.Echo sale.Title

    Set activities = sale.GetActivityList( 1 )
    For Each item In activities
        WScript.Echo item.RowType & "    " & item.Date
        WS­cript.Echo item.Appointment.Task.Text
        For Each key In item.Appointment.Task.Keys
            WScript.Echo key & ": " & item.Appointment.Task.Value( key )
        Next
    Next

Else
    WScript.Echo "Unable to get applicaiton instance"
End If

Since you are fetchingonly appointment rows, the item.Appointment should never be null.

/conrad

Af: Conrad Weyns 28. jan 2019

RE: GetActivityList on Sale

Thank you conrad, that was just what i needed :) 

//Eivind

Af: Eivind Johan Fasting 8. feb 2019