I have a field on a salesorder that only allows ed...
# suitescript
p
I have a field on a salesorder that only allows edits by certain roles. The issue I am having is that when that salesorder is copied the data in that field is copied over as well. I though I could solve this by using a pageInit script and this works in sandbox but in production it does not. I double checked the fieldId and it is correct. Any idea why this may be happening:
Copy code
var recCurrent = context.currentRecord;
        var internalId = recCurrent.getValue({
            fieldId: 'id'
        });
              // Clear Reason For Low Margin
        if (context.mode === 'create') {
            recCurrent.setValue({
                fieldId: 'custbody265',
                value: null
            });
        }
b
shouldnt have worked in sandbox, create is not copy
p
too early for this - i was looking at the wrong record in sandbox. corrected my mistake and made it context.mode === 'copy' and that did it.