Skip to Content
0

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

Jan 25, 2017 at 07:35 AM

295

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Edy Simon Jan 25, 2017 at 08:42 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 25, 2017 at 08:43 AM
0

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);
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 26, 2017 at 08:29 AM
0

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

}

Share
10 |10000 characters needed characters left characters exceeded