This topic contains 1 reply, has 0 voices, and was last updated by T.Watz 6 years, 6 months ago.

  • Author
    Posts
  • #21242 Score: 0

    T.Watz
    • Contributions: 0
    • Level 1

    Hi I've had a client script deployed that in the event of a user chooses a partner on the transaction. It copies in the default address from the partner and sets it as an custom address. This has worked since I implemented it, which is more then a year. Now, since very recently, this script does not function correctly. The order displays the correct custom address, but in the background it seems as the default billing address for the customer is still lurking.

    When I perform a search on the transaction to list what {billaddress} and {billaddressee} has stored, the {billaddress} shows the address from the partner but the {billaddressee} (and {billadr1} …etc) shows the address from the customer.

    The way I set the address is with the following code:

    Code:
    var readrecord = nlapiLoadRecord('customer', partnerID);
    for(var x = 1; x <= readrecord.getLineItemCount('addressbook'); x++) {
    if (readrecord.getLineItemValue('addressbook', 'defaultbilling', x) == 'T') {
    BillAddress = readrecord.getLineItemValue('addressbook', 'addrtext', x);
    BillAddressee = readrecord.getLineItemValue('addressbook', 'addressee', x);
    BillAddress1 = readrecord.getLineItemValue('addressbook', 'addr1', x);
    BillAddress2 = readrecord.getLineItemValue('addressbook', 'addr2', x);
    BillAttention = readrecord.getLineItemValue('addressbook', 'attention', x);
    BillCity = readrecord.getLineItemValue('addressbook', 'city', x);
    BillState = readrecord.getLineItemValue('addressbook', 'state', x);
    BillCountry = readrecord.getLineItemValue('addressbook', 'country', x);
    BillZip = readrecord.getLineItemValue('addressbook', 'zip', x);
    break;
    }
    }
    nlapiSetFieldValue("billaddresslist", "", false, true);
    nlapiSetFieldValue("billaddress", BillAddress,false, true);
    nlapiSetFieldValue("billattention", BillAttention, false, true);
    nlapiSetFieldValue("billaddressee", BillAddressee, false, true);
    nlapiSetFieldValue("billaddr1", BillAddress1, false, true);
    nlapiSetFieldValue("billaddr2", BillAddress2, false, true);
    nlapiSetFieldValue("billcity", BillCity, false, true);
    nlapiSetFieldValue("billstate", BillState, false, true);
    nlapiSetFieldValue("billzip", BillZip, false, true);
    nlapiSetFieldValue("billcountry", BillCountry, false, true);
    nlapiSetFieldValue("billoverride", 'T', false, true);
    nlapiSetFieldValue("billisresidential", 'F', false, true);
    Does anyone have any ideas or should it be set in a better way? (I need it to be a client script for the instant feedback to the user)
    This is a cached copy. Click here to see the original post.

  • #21243 Score: 0

    T.Watz
    • Contributions: 0
    • Level 1

    I did some in-browsing trial and error, and found out that everything resets when I set the {billcountry}. So setting the {billcountry} right after the {billaddresslist} solved it.

    When looking through the documentation I remember I read about this, but as it has worked for so long. I didn't think much about it. Maybe it was a bug to be able to set the country last.

You must be logged in to reply to this topic.