I am trying to update a field after a record is su...
# suitescript
p
I am trying to update a field after a record is submitted but the field is not updating. I know the script is firing because the debug is showing the oldweight value. Can you not update a field in an AfterSubmit userevent.
Copy code
// 2.0 - Fluent
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
define(["N/record"], function (r) {
    function onAfterSubmit(context) {
        var  oldweight = context.newRecord.getValue({ fieldId: 'custbody93' });

            log.debug({
            title: 'Old Weight',
            details: oldweight
            });

        if (oldweight) {
            var fixWeight = context.newRecord;
            context.newRecord.setValue('custbody103', 'oldweight');
        };
    }  
   return {
        afterSubmit: onAfterSubmit
    };
});