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
});
}
}
}