Default ShipDate instead of using ShipExpireDate when an invoice is created from a sales order.

SOLVED

Currently I can set the default ShipDate on SO_InvoiceHeader using Custom Office however the moment I link a Sales Order to it the ShipDate changes to whatever the ShipExpireDate is for that Sales Order.  How can I prevent that and keep the default of the current days date?  I've played around with trying to get a user defined script to accomplish it but haven't had any luck figuring it out exactly.  Anyone have any ideas?

  • +1
    verified answer

    Custom Office > Main > User-Defined Field and Table Maintenance

    Expand Sales Order folder

    Locate SO Invoice Header

    Right click it

    Click User-Defined Scripts

    Click Add button

    Set Event to Column - Post-Validate

    Set Field to SalesOrderNo

    Set Script to a value that makes sense to call your script

    When prompted to create the script file, click yes

    Paste oBusObj.SetValue "ShipDate$", oSession.SystemDate into the Script field

    You could also use oSession.ModuleDate instead of oSession.SystemDate

    Click Accept

    Click Ok

    Click Close

    Click Close

    Click Compile

    Click Close

    The script won't take affect until the next time SO Invoice Data Entry is launched after the script has been compiled.

  • 0 in reply to David Speck

    Excellent.  Looks like I was overcomplicating my approach at it.  

    So if I can ask an additional question about this?  Here is our current approach.

    1) A new invoice is started.  This is where the ShipDate defaults to whatever you have it set to.  Ours is SystemTime.

    2) A Sales Order is attached to the invoice.  At this point the ShipDate changes to whatever the ShipExpireDate is on the attached Sales Order.

    3) The line details are copied over and the Invoice gets saved/created.

    Using the steps you provided the ShipDate would change to the SystemDate at step 3, correct?

    How could I have that same thing happen after step 2, but before step 3?  The reason is that 90% of the time the SystemDate is exactly what they want but occasionally they need to change it and your steps wouldn't allow for a manual change, correct?

    Thanks again!

  • 0 in reply to justinp

    This script will be processed after sage 100 has validated the sales order number entered and copied over the sales order header information. So you could say it will happen between your steps 2 and 3 and the user will be able to manually change the ship date as needed before saving the order.

  • 0 in reply to justinp

    "When" it happens is determined by the script trigger, which in David's excellent example is your step 2.

  • 0 in reply to David Speck

    Awesome.  Thanks again for your explanation.