Event issue when inserting additional saleslines using code

mo_xmo_x Posts: 38Member

i have a small issue regarding events. I'm inserting additional saleslines using event onModify. For example, when the line is modified several lines is added. That part works correct. But the issue is when posting. When i specify amount on "qty to-ship" and post it as "shipping", the "quantity shipped" field on salesline becomes empty afterwards. Hope the issue is understandable.


  • bilalraibilalrai Posts: 50Member
    I have worked on an issue exactly like this but it is working fine. Can you confirm that after posting as "ship" does an item ledger entry or sales shipment document is created ?
  • bilalraibilalrai Posts: 50Member
    And does quantity shipped field becomes empty for all lines or just in the lines that you have inserted using event.
  • mo_xmo_x Posts: 38Member
    Hey bilarai,
    It only becomes empty for the lines that i inserted with events. Bu posted sales shipment shows the correct value, only on sales order it becomes empty.
  • JuhlJuhl Posts: 523Member
    Do you validate all fields on insert?
    Have you compared all fields of a manual line and a code inserted line?

    But a breakpoint on your events and see if they get hit unexpectedly during posting.
    Follow me on my blog juhl.blog
  • mo_xmo_x Posts: 38Member
    Hey juhl,
    The insert part works perfectly, but when modifying the field qty to ship, the quantity shipped becomes empty. I think the problem is that i'm inserting new line using onafterModify event. And that resets the fields.
  • JuhlJuhl Posts: 523Member
    I don't think so, from what I can read.
    Inserting the line based on a condition, has nothing to do with posting.
    That's why you need to compare the lines by running the table, to see all fields.
    Something must be different in the lines with error.
    The system can't tell the difference on how the lines was created, so it's not an event issue, but data related.

    Unless you have custom code on the posting as well?
    Follow me on my blog juhl.blog
Sign In or Register to comment.