The execution context of user-event script is affected by CSV Import preference.
Using Administrator role navigate to Setup > Import/Export > CSV Import Preferences, check setting for”Run Server SuiteScript and Trigger Workflows”.
If this preference is enabled (checked), then user-event script is triggered and all three events (beforeLoad,beforeSubmit and afterSubmit) are executed and the context is csvimport.
If the preference is disabled, the user-event script gets also triggered, but performs only actions defined in the beforeLoadfunction – and with context userevent.