I have a client script that needs to manipulate so...
# suitescript
s
I have a client script that needs to manipulate some data on page init for CREATE and EDIT. A UE doesn't work because it needs to run on edit. However, whenever I update and commitLine in pageInit I get "You must enter in ..." whichever columns are empty. Is there a way around this?
Copy code
function pageInit(ctx) {
    const sublistId = 'item';

    const curRec = ctx.currentRecord;
    const lineCnt = curRec.getLineCount('item');
    for (let line = 0; line < lineCnt; line++) {
        curRec.selectLine({ sublistId, line });
        const returnCode = curRec.getCurrentSublistValue({ sublistId, fieldId: 'class' });
        curRec.setCurrentSublistValue({
            sublistId,
            fieldId: 'custcol_ad_tat_code',
            value: returnCode,
            ignoreFieldChange: true
        });
        curRec.commitLine({ sublistId });
    }
}
l
looks like you’re trying to copy the value from one column to another one, you could add this to modified field because it will be empty when a new line is created. OR if this new field is no mandatory, add this logic to before submit UE