on 05-28-2007 8:00 PM
i'm trying to insert ship to address an bill to address to a BusinessPartner using JAVA.
code:
IBusinessPartners ib = SBOCOMUtil.newBusinessPartners(company);
ib.setCardCode("994");
ib.setCardName(bp.getNome());
ib.setCardType(SBOCOMConstants.BoCardTypes_cCustomer);
ib.setEmailAddress(bp.getEMail());
ib.setPhone1(bp.getTelefone());
ib.setCellular(bp.getTelCel());
ib.setFax(bp.getFax());
ib.getUserFields().getFields().item("U_nomeMae").setValue(bp.getNomeMae());
ib.add();
System.out.println(company.getLastErrorDescription());
ib.getAddresses().setAddressName("Cobrança");
ib.getAddresses().setCurrentLine(0);
ib.getAddresses().setStreet(bp.getEndereco());
ib.getAddresses().setCity(bp.getCidade());
ib.getAddresses().setZipCode(bp.getCep());
ib.getAddresses().setAddressType(SBOCOMConstants.BoAddressType_bo_BillTo);
ib.getAddresses().setState("SP");
ib.getAddresses().setCountry("BR");
ib.getAddresses().setBlock("");
ib.getAddresses().add();
ib.getAddresses().setAddressName("Entrega");
ib.getAddresses().setCurrentLine(1);
ib.getAddresses().setStreet(bp.getEndereco());
ib.getAddresses().setCity(bp.getCidade());
ib.getAddresses().setZipCode(bp.getCep());
ib.getAddresses().setState("SP");
ib.getAddresses().setCountry("BR");
ib.getAddresses().setBlock("");
ib.getAddresses().setAddressType(SBOCOMConstants.BoAddressType_bo_ShipTo);
ib.getAddresses().add();
ib.setShipToDefault("Cobrança");
ib.update();
when I execute this code, It inserts the BP but it does not insert the adresses.
I get this message: <b>"The object's key is not set"</b>
What am i doing wrong?
Please, if anyone could help me, i'll apreciate it.
Even C# examples
tks
Elcio
Trying adding a GetByKey after the add ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this :
Remove "ib.update();"
Move the "ib.add();" and the end (in place of "ib.update();")
Delete the last "ib.getAddresses().add();"
(you have to call "ib.getAddresses().add();" before adding address and not after, but it is not needed for the first address)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
10 | |
9 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.