cancel
Showing results for 
Search instead for 
Did you mean: 

Service Call Activity

Former Member
0 Kudos

Hi all,

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?

Regards, Lita

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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
    sboContact.Add
    
    'Get Activity Code
    lngDocEntry = sboCompany.GetNewObjectKey
    
    'Assign Activity to Service Call
    Set sboServiceCall = sboCompany.GetBusinessObject(oServiceCalls)
    sboServiceCall.GetByKey 31
    sboServiceCall.Activities.Add
    sboServiceCall.Activities.ActivityCode = lngDocEntry
    sboServiceCall.Update
    
End Sub

John.

Former Member
0 Kudos

I had the same issue as Lita did and

This entry saved my day.

Thanks,

Indika.

Answers (0)