Search code examples
loadnetsuiterecord

Netsuite record.load


I can load a record with a hardcoded ID, but I'm not sure how to get this dynamically during a create on after submit method for a user event script. This code is in an if block for UserEventType create. Is there some variable to use for id for newrecord?

thank you

            var Bill = record.load({
                type: record.Type.VENDOR_BILL, 
                id: 13295,
                isDynamic: true
                });

Solution

  • On create the record id is not available until the after submit phase. There you can get it from the newRecord

    function afterSubmit(context){
        const newRec = context.newRecord;
        const billRec = record.load(
            type:newRec.type,
            id:newRec.id,
            isDynamic:true
        });
        ...