Skip to Content
avatar image
Former Member

update Contact Person

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Oct 24, 2016 at 10:43 AM

    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

    Add comment
    10|10000 characters needed characters exceeded