0
votes

I created a super basic user event script for Sales Order records, shown below. I enabled every execution context and have not set an Event Type filter.

The script executes as expected for events involving the Sales Order record itself, but it does not fire when a modification is made directly to a line item on the Sales Order record. For example, if inventory is committed or reallocated, these actions do not trigger the script.

Are sublist modifications not candidates for user event scripts?

/**
 *@NApiVersion 2.x
 *@NScriptType UserEventScript
 */
define(["N/record", "N/log"],
    function (record, log) {

        function beforeSubmit(context) {
            log.debug("beforeSubmit:" + context.type);
        }

        function afterSubmit(context) {
            log.debug("afterSubmit:" + context.type);
        }

        function beforeLoad(context) {
            log.debug("beforeLoad:" + context.type);
        }

        return {
            beforeLoad: beforeLoad,
            beforeSubmit: beforeSubmit,
            afterSubmit: afterSubmit
        };

    });
1

1 Answers

1
votes

User Events are not triggered by changes to records related to the scripted record (e.g. another Transaction, an Item, a Customer, Inventory, etc). A change in Inventory is not a change to the Sales Order, thus it won't trigger Sales Order User Events.

If you want to monitor inventory movements in real-time, you'll need User Events on the records/transactions which cause the movement.