Setting the Create PO field to null via SuiteScript

function beforeSubmit(type){
	var count = objRecord.selectLine({
		sublistId: 'item',
		line: i
	});


	for (i=1; i<= count; i++)    {
        var currentContext = runtime.executionContext();


        //setting of 'createpo' field only happens when the script is triggered via Web Services
        //add other if conditions here, if needed
        if((currentContext.getExecutionContext() == 'webservices'))        {
           objRecord.setSublistValue({
				sublistId: 'item',
				fieldId: 'createpo',
				line: i,
				value: null
			});
        }
    }
}

Leave a comment

Your email address will not be published. Required fields are marked *