tI_tsoSOLineDist

SOLVED

Hello!

We wanted to capture the original shipdate (tsosolinedist.shipdate) entered into the system, so that when this value gets updated we can track how many days out from the original date we are.  

So near the end of the insert trigger for tsosolinedist, I added the following code:

declare @shipdate datetime
select @shipdate = shipdate from inserted
insert into tsosalesorderorigshipdate_exi (solinedistkey, origshipdate)
values (@newkey, @shipdate)

It works! However it's only capturing one line item per sales order. What can I do to make it capture all lines? 

  • 0
    verified answer

    Hi,

    In the insert trigger change your SQL statement as:

    insert into tsosalesorderorigshipdate_exi (solinedistkey, origshipdate)

    select solinedistkey, shipdate

    from inserted

    Garik Melkonyan

    www.GarikMelkonyan.com

  • 0 in reply to garmel

    thanks so much for the quick response! once it started working i realized i need to add further filtering as to only collect solines and not quote lines or blanket lines

    insert into tsosalesorderorigshipdate_exi (solinedistkey, origshipdate)

    select solinedistkey, shipdate

    from inserted, tsosoline with (nolock), tsosalesorder with (nolock)

    where inserted.solinekey = tsosoline.solinekey

    and tsosoline.sokey = tsosalesorder.sokey

    and tsosalesorder.trantype = 801

    this is what i have now.