cancel
Showing results for 
Search instead for 
Did you mean: 

How to add new activity in SDK SAP B1 with UserDefind Fields ?

nitmanet168
Explorer
View Entire Topic
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi nitmanet168,

Use the following sample code:

var ActivitiesService = (SAPbobsCOM.ActivitiesService)oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.ActivitiesService);
SAPbobsCOM.Activity activity = (SAPbobsCOM.Activity)ActivitiesService.GetDataInterface(SAPbobsCOM.ActivitiesServiceDataInterfaces.asActivity);
activity.CardCode = "C20000";
activity.Details = "Test DI";
activity.DocEntry = "1344";
activity.DocTypeEx = "15";
activity.UserFields.Item("U_TEST").Value = "TEST";
ActivitiesService.AddActivity(activity);

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

Thiago_Moura
Explorer
0 Kudos

Hello Ankit!

Why should I use ActivitiesService ?

I have this doubt not just for ActivitiesService, but all the classes ending with "Service".. Is there some specific use?

Thank you!

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi thiago_moura,

DI API provides an interface to the company database of SAP Business One, enabling data manipulation.

This is possible via DI API Services, Objects, and Public Enumerations.

Few objects are exposed under BoObjectTypes enumeration and few complex objects are exposed under ServiceTypes Enumeration.

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

nitmanet168
Explorer
0 Kudos

Big Thanks