This topic contains 6 replies, has 0 voices, and was last updated by tect22 8 years, 2 months ago.

  • Author
    Posts
  • #6283

    ryan.austria

    Hello there,

    Good day!

    I have a problem, and I don’t know yet how to solve this problem. I have a script for Vendor payment and I want to get the value (‘transactionnumber’) of Vendor Bill and apply it to Vendor payment (printout).

    Please see sample transaction below :

    1. Vendor Payment

    2. Vendor Bill

    3. Vendor Payment Printout

    Thank you so much.
    This is a cached copy. Click here to see the original post.

  • #6284

    michoel

    Can be done, but the potential issue here is that there is not a one-to-one relationship between the Bill Payment and Bills. How do you want to handle this in the case that a Bill Payment is for multiple Bills?

  • #6285

    ryan.austria

    Hello there, thank you for response.

    For multiple bills in a single bill payment the transaction number (PV NO) will be indicated in printout separated by commas.

  • #6286

    michoel

    I would suggest you create a new Custom Transaction Body Field in the Bill Payment to store the transaction numbers.

    You can get your script to populate this, and then it should be available on the printout.

  • #6287

    k_dunc

    michoel is spot on. Given that there could be a many-to-one relationship between Bills and one Bill Payment, you’d need to write some code to handle this. I’d suggest something like a User Event Script to execute on After Submit perhaps. In the code, you’d want to do something like:Get a line count of the number of ‘apply’ sublist line items. E.g.: var lineCount = nlapiGetLineItemCount(‘apply’);
    Next, create a for-loop that iterates through this sublist and grabs each line’s transaction number. Just remember that sublists begin at line 1, so it will need to be something like:

    Code:
    for (var sublistLine = 1; sublistLine <= lineCount; sublistLine++)
    {
    var tranID = nlapiGetLineItemValue('apply','internalid', subListLine);
    bills = bills + ', ' + tranID;
    }
    Now I haven't tested any of that, but I think that will be the general idea. You'd probably also want to ensure 'bills' is not null before adding the comma and space as that will be the first thing you see when you then ultimately store the 'bills' value in your Custom Transaction Field that you want to pull into your Voucher.

    Hope something like that gets you on the right track.

  • #6288

    k_dunc

    Actually, I’ve just come across this answer. This should help you get it done properly: https://netsuite.custhelp.com/app/an…bill%20payment

  • #6289

    tect22

    Hi Ryan,

    As k_dunc indicated, there could be a many-to-one relationship, you may make a search for this vendorpayment records, with columns Applied To Transaction : Transaction Number, so that you could get the connected transactions to this vendorpayment. But keep in mind, that it may result many records connected to the vendorpayment and might “overflow” your allotted field on your PDF layout.

    Hope this helps.

You must be logged in to reply to this topic.