Does anyone know how to create a service call activity? I've created a service call but now I need to create an activity for that service call. The DI help file states that you need to specify the ActivityCode, and then I assume you call the Add method.
But where or how do you obtain an ActivityCode? I've tried setting it to the newly created service call and also to a value of 1 but both of these attempts did not work.
Also the Add method does not return a value, so you can't determine whether or not the activity has been created unless you look at the service activiy table or the activity screen.
Does anyone else have any experience in this area?
If you create the activity first, this will give you an activity code which you can then use for the service call activity object.
Here is a sample adding a new activity to an existing service call.
Private Sub ServiceCallActivities()
Dim sboServiceCall As SAPbobsCOM.ServiceCalls
Dim sboContact As SAPbobsCOM.Contacts
Dim lngDocEntry As Long
'Create a new Activity
Set sboContact = sboCompany.GetBusinessObject(oContacts)
sboContact.CardCode = "SLU003"
sboContact.Closed = tNO
sboContact.ContactDate = Date
sboContact.Details = "Details...."
sboContact.Notes = "Sample notes..."
sboContact.DocType = oServiceCalls
sboContact.DocEntry = 31
'Get Activity Code
lngDocEntry = sboCompany.GetNewObjectKey
'Assign Activity to Service Call
Set sboServiceCall = sboCompany.GetBusinessObject(oServiceCalls)
sboServiceCall.Activities.ActivityCode = lngDocEntry