Skip to Content
avatar image
Former Member

Deleting a Business Partner Address Using DI SDK gives me Invalid Row Error

Hello,

I'm trying to delete a business partner's address using DI SDKbp.Addresses.SetCurrentLine(address.LineNum);

Eventhough I got the LineNumber from the table CRD1 Field LineNum it's gives me an error that it's an invalid row number

below is a sample of my code:

BusinessPartners bp = comp.GetBusinessObject(BoObjectTypes.oBusinessPartners);

bp.GetByKey(cardcode);

bp.Addresses.SetCurrentLine(address.LineNum);

bp.Addresses.Delete();

int ret= bp.Update();

Thank You

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Jan 25, 2017 at 08:42 AM

    Hi Basil,

    Most of objects, the setCurrentLine method never takes in LineNum. It would takes in a special ordering rank.
    ie, in Document Objects is the visOrder.
    In case of BPAddresses is the ordering of the Addresses sort by Address and AdresType fields.

    Look here

    Regards
    Edy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 25, 2017 at 08:43 AM

    Have you tried to manually input the Row in the

    Or check the VisOrder column to get the real LineNum.

    bp.Addresses.SetCurrentLine(address.LineNum);
    
    to
    
    bp.Addresses.SetCurrentLine(1);
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 26, 2017 at 08:29 AM

    the problem was resolved by getting the order from the address object in the SDK

    BPAddresses curAddress = bp.Addresses;

    for (int x =0; x<=bp.Addresses.Count; x++) {

    curAddress.SetCurrentLine(x);

    // then I check the address I want to delete by it's name etc

    }

    Add comment
    10|10000 characters needed characters exceeded