Scripting

  • 1.  I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 12:16
    I'm generating SO Invoices via Auto Generate Invoice Selection, but only for Orders with a ""Y"" in the ""Export Today"" UDF. Once the invoice is generated, I need to reset the UDF value to N on every order for which an invoice was created. Unfortunately, once an invoice exists, the order is locked for editing. Can anyone think of an alternative?


  • 2.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 12:30
    Are you sure you would WANT to change the orders before invoices post instead of adding an end of day step? What happens if they cancel the invoice?


  • 3.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 12:32
    If the sales orders are invoiced in full wouldn't that take care of them?


  • 4.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 12:33
    How about a VI?


  • 5.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 13:18
    Thanks for the suggestions. @JeffSchwenk - I tried VI and no go (I get an error, as logic is probably checking value of CurrentInvoice field before updating). @DanBurleson - I have no preference whether it's done before or after, but think it gets more complicated if done after (there may be mutiple postings per day and I'd need to reset the UDF as part of each update, instead of a end-of-day routine). @LouisAraiza - There are backorders, so this would not work all the time. A sales Order may be exported several times (every time a shipment occurs), so this UDF serves as a trigger to create an invoice for each shipment. Since I don't know what will actually ship from the order, I have to create the invoice without shipping in full. Several days later, I receive a file of the lines actually shipped, which is my source file for VI import to update the invoices. All these invoices sit in a HOLD batch. Once updated, I'll move them to a new batch by using SO-1100 (Enhanced Batch Processing from DSD), or a script (if cost effective). Client basically takes an order, marks it for shipping via the UDF, generates an invoice for all orders with a Yes UDF value, sends file to another vendor to ship product, gets a daily file of items shipped, imports the shipments into existing invoices and moves said invoices into a new batch so they can be updated. Once done, I need to reset the UDF value on the order to prepare it for the next time another shipment occurs.


  • 6.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 13:34
    Why is it important to have an invoice number? Why not import what actually ships into invoice entry and create an invoice at that point. I think I see what is happening but puzzled why you have to generate an invoice then put it on hold.


  • 7.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 13:58
    @JeffSchwenk - I'm generating an invoice because the vendor needs a unique number for each shipment, so a Sales Order # won't work if there are multiple shipments. Additionally, the import file only contains inventory items, but the order may have misc. charges which need to be invoiced as well (Auto generate allows me to create an invoice with no shipments, but does bring in misc charges). Lastly, I don't want anyone messing with the order once it's exported, as it may cause problems if lines are added or removed. All the invoices awaiting shipment details are in a batch called HOLD (to alert data entry not to update the batch). That batch is also prevented from posting because it's invoices are awaiting shipment details.


  • 8.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-19-2011 23:28
    All your options that would use business objects to reset the UDF value (V/I, Customizer scripting, BOI, Web Services, Providex) would run into the issue of the order being locked for editing. However, if it is true that you could use DFDM to modify the value (you would need to verify that - make sure a ""record in use"" error doesn't occur) then it would also be true that a Providex legacy style utility could be written that would ask you for the Invoice batch number, then identify the associated order No, then directly access Sales Order Header table (w/o using bus objects), find the order record, read it in, and write it back using the new UDF value. Then rinse and repeat for the whole batch.


  • 9.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-20-2011 10:03
    @AlnoorCassim - Thanks Alnoor. I verified that DFDM does allow changes to the UDF when the order is locked. Could this utility be Perform Logic that can be invoked while invoice shipments are being imported?


  • 10.  RE: I'm generating SO Invoices via Auto Generate Invoi

    Posted 09-20-2011 20:58
    Yes it can be run as V/I Perform Logic. Setting it to run On Completion of the import job would be the ideal event.