cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a new Activity in C#

Former Member
0 Kudos

Hello Experts,

I want to add a new Activity using C#. Can anyone help me, by giving example code?

Best regards

ES.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This is a method we use to create an activity when we send a BP our Brochure....information is coming from a grid within a form and is being used to create the activity.

private void UpdateBrochu(int nSelected) // form update to db

{

SAPbouiCOM.Grid oGrid = (SAPbouiCOM.Grid)theForm.Items.Item("grdBrochr").Specific;

// add activity to database..............................................................................................

int nErr = 0;

string sErr = "";

SAPbobsCOM.Contacts oACT = ((SAPbobsCOM.Contacts)(theCompany.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oContacts)));

oACT.CardCode = m_sCardCode;

oACT.Details = "Brochure to be Sent: " + oGrid.DataTable.GetValue("Item", nSelected).ToString() + " "

+ oGrid.DataTable.GetValue("Description", nSelected).ToString();

oACT.Notes = "Brochure to be Sent.";

oACT.ContactDate = System.DateTime.Now;

oACT.Add();

theCompany.GetLastError(out nErr, out sErr);

if (nErr != 0)

theApp.MessageBox("Your record was not able to be added.\nError: " + sErr, 1, "Ok", "", "");

else

{

theApp.StatusBar.SetText("Operation Completed Successfully.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);

}

}

Hopes this helps.

Mitch

Former Member
0 Kudos

Thank You Mitch, You solved my problem.

ES

Answers (0)