This is a neat hack if youre tired of requiring NS...
# suitescript
u
This is a neat hack if youre tired of requiring NS modules every time you open the console you can create a inline HTML field on any record you want and add the following code as the default value. That way, your modules are loaded every time you open which ever record you add this field on
Copy code
<script>
require([
    'N/record',
    'N/runtime',
    'N/search',
    'N/query',
    'N/currentRecord'
], function (
    record,
    runtime,
    search,
    query,
    currentRecord
) {
    window['record'] = record;
    window['runtime'] = runtime;
    window['search'] = search;
    window['query'] = query;

    let cr = currentRecord.get();

    let id = cr.id;
    let type = cr.type;

    let rec = record.load({
        type:type,
        id:id,
        isDynamic:true
    });
    
    window['id'] = id;
    window['type'] = type
    window['rec'] = rec;
});
</script>
👍 2