Katie Kardok
12/16/2020, 6:37 PMInvalid orderstatus reference key [object Object] when I attempt to utilize a workflow action script to change the order status from "pending approval" to "pending receipt" on a Return Authorization. Any idea what could be the reason for this?Katie Kardok
12/16/2020, 6:38 PMdefine(['N/record','N/search','N/ui/dialog', 'N/log'], function (record, search, dialog, log) {
    
    function onAction(scriptContext) {
        var currentRecord = scriptContext.newRecord;
      
      var intid = currentRecord.id;
        log.debug({
        title: 'Internal ID',
        details: intid
        });
        
        var Status = currentRecord.setValue({
            fieldId: 'orderstatus',
          	value: 'B'
        });
        log.debug({
            title: 'Order Status', 
            details: Status
        });
        
        dialog.alert({
            title: 'Return Aurhotization',
            message: 'You are viewing ' + currentRecord
        });
      	return Status
    }
 
    return {
        onAction: onAction
    }
    
});Sandii
12/16/2020, 6:47 PMlet rec = record.load({type: record.Type.RETURN_AUTHORIZATION, id: 79848, isDynamic: true});
rec.setValue({fieldId: 'orderstatus', value: 'B'});
rec.save();Sandii
12/16/2020, 6:48 PMSuiteBender
12/16/2020, 6:49 PMSandii
12/16/2020, 6:50 PMcontext.newRecord.setValue({fieldId: 'orderstatus', value: 'B'}), nothing else is needed there