Showing results for 
Search instead for 
Did you mean: 

How to insert the Address Component in a Invoice Draft

Former Member
0 Kudos

Hi everyone!

I have a system that creates a Invoice Draft. I´m using the DI API and everything is alright except for the Address Component in the Logistics tab.

In the code I use this:

oDraft.AddressExtension.ShipToAddressType = recordSetCompany.Fields.Item("AddrType").Value.ToString();

oDraft.AddressExtension.ShipToStreet = recordSetCompany.Fields.Item("Street").Value.ToString();

oDraft.AddressExtension.ShipToStreetNo = recordSetCompany.Fields.Item("StreetNo").Value.ToString();

oDraft.AddressExtension.ShipToBuilding = recordSetCompany.Fields.Item("Building").Value.ToString();

oDraft.AddressExtension.ShipToZipCode = recordSetCompany.Fields.Item("ZipCode").Value.ToString();

oDraft.AddressExtension.ShipToBlock = recordSetCompany.Fields.Item("Block").Value.ToString();

oDraft.AddressExtension.ShipToCity = recordSetCompany.Fields.Item("City").Value.ToString();

oDraft.AddressExtension.ShipToState = recordSetCompany.Fields.Item("State").Value.ToString();

oDraft.AddressExtension.ShipToCounty = recordSetCompany.Fields.Item("County").Value.ToString();

oDraft.AddressExtension.ShipToCountry = recordSetCompany.Fields.Item("Country").Value.ToString();

This code works for the Ship To Address Component. But, for the Pay To Address Component, this code doesn´t work:

var oBP = (BusinessPartners)cp.GetBusinessObject(BoObjectTypes.oBusinessPartners);


oDraft.AddressExtension.BillToAddressType = oBP.Addresses.TypeOfAddress;

oDraft.AddressExtension.BillToStreet = oBP.Addresses.Street;

oDraft.AddressExtension.BillToStreetNo = oBP.Addresses.StreetNo;

oDraft.AddressExtension.BillToBuilding = oBP.Addresses.BuildingFloorRoom;

oDraft.AddressExtension.BillToZipCode = oBP.Addresses.ZipCode;

oDraft.AddressExtension.BillToBlock = oBP.Addresses.Block;

oDraft.AddressExtension.BillToCity = oBP.Addresses.City;

oDraft.AddressExtension.BillToState = oBP.Addresses.State;

oDraft.AddressExtension.BillToCounty = oBP.Addresses.County;

oDraft.AddressExtension.BillToCountry = oBP.Addresses.Country;

This is correct? Any idea to do this works?

Best Regards.


Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor
0 Kudos

Hi João,

Do you get an error? Does it not populate the data?

Can you clarify?

Best regards,

Pedro Magueija

View Pedro Magueija's profile on LinkedIn

Former Member
0 Kudos

Hi Pedro, thanks for replying me.

No error is returned and this code doesn´t populate the data.

But I could solve my problem.

The error was in the sequence of the population of parameters.

I was assigning values to the attributes Address and Address2. But to populate this two attributes, first you must populate the Address Component.

After this, the system will copy all the information to the fields Address and Address2.

That´s it!

Thank you very much!



Active Contributor
0 Kudos

Hi João,

That's great, please close the Thread and mark your own answer as correct.


Best regards,

Pedro Magueija

View Pedro Magueija's profile on LinkedIn

Answers (0)