Skip to Content
0

update Contact Person

Oct 21, 2016 at 08:23 AM

392

avatar image
Former Member

Dear experts,

Is there any way to delete exiting contact person for particular BP and update New one contact person in DI API ( SDK) ?

Regards

Sath.

10 |10000 characters needed characters left characters exceeded

Hi Sath,

Please add the SAP Business One SDK tag to this question.

Regards,

Johan

0

can contact your SAP partner for that.

Thanks,

Kaushik

0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Oct 24, 2016 at 10:43 AM
0

Hi Kandasamy,

Yes, there is.

Below a sample code how to update or delete a contact person from Business Partner.

                //Update sample
                BusinessPartners oBp = oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);
                if (oBp.GetByKey("your bp"))
                {
                    //For update
                    //Set the current line of the contact of you want to update
                    //or do a loop to find the contact that you want update
                    oBp.ContactEmployees.SetCurrentLine(0);


                    //the info that you want update
                    oBp.ContactEmployees.Name = "Name";
                    oBp.ContactEmployees.Phone1 = "phone";
                    oBp.ContactEmployees.E_Mail = "email";
                    oBp.ContactEmployees.Position = "position";
                    if (oBp.Update() != 0)
                    {
                        MessageBox.Show(oCompany.GetLastErrorDescription());
                    }
                }


                //Delete sample
                oBp = oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);
                if (oBp.GetByKey("your bp"))
                {
                    //For update
                    //Set the current line of the contact of you want to delete
                    oBp.ContactEmployees.SetCurrentLine(1);
                    //delete the current contact
                    oBp.ContactEmployees.Delete();
                    if (oBp.Update() != 0)
                    {
                        MessageBox.Show(oCompany.GetLastErrorDescription());
                    }
                }

Kind Regards,

Diego Lother

Share
10 |10000 characters needed characters left characters exceeded