I am new to writing suitescript. I just don't have...
# suitescript
k
I am new to writing suitescript. I just don't have a clear reference if what I am doing is correct because I am struggling with getting the script debugger to work. Does this make sense?
Copy code
const beforeSubmit = (scriptContext) => {

    var objRecord = currentRecord.get();

    var standardRoyalty = objRecord.getValue({
        fieldId: 'custrecord_lf_school_std_roy_perc'
    });
    var headwearRoyalty = objRecord.getValue({
        fieldId: 'custrecord_lf_school_hdwr_roy_perc'
    })
    var id = record.submitFields({
        type: record.Type.CUSTOMER,
        id: 3698,
        values: {
            'custentity_lf_hdwr_roy_new': headwearRoyalty,
            'custentity_lf_std_roy_rate_new' : standardRoyalty
        }
    })
}
n
In beforeSubmit you get access to the record with scriptContext. So i would change your first line to
var objRecord = scriptContext.newRecord
I would also steer away from hard coding a customer ID into your submitFields(). But i understand this may just be for testing.
Other than that, looks good 👍