Hi All I am referring to following SuiteAnswer: 24...
# general
m
Hi All I am referring to following SuiteAnswer: 24776 I have created a workflow action script based on this:
Copy code
/**
 * Script is used to find the next approver.
 *
 * @NApiVersion 2.x
 * @NScriptType WorkflowActionScript
 */
define(['N/workflow', 'N/record', 'N/search', 'N/runtime'],
function (workflow, record, search, runtime) {
function onAction(scriptContext) {
    	
    	var newRecord = scriptContext.newRecord;
		
		log.debug('newRecord',newRecord)

    	log.debug({
    		title: 'Print Log', 
    	    details: newRecord.id + ', ' + newRecord.type + ', last printed on: ' + new Date()
    	})
    	
		
		//newRecord.setValue({
        //                   
        //                    fieldId: 'custbody_dyn_mf_printed',
        //                    value: true
        //                });
    	//
		
		newRecord.submitFields({
    	    type: record.Type.SALES_ORDER,
    	    id: newRecord.id,
    	    values: {
				
    	        custbody_dyn_mf_printed: true
    	    }
    	});
		
		
}

 return {
            onAction: onAction
        }
    });
And a workflow action before as on entry. But during the PDF printing I get always this error:
Copy code
Error during loading transaction for advanced printing
Caused by:
        com.netsuite.suitescript.exception.NLServerSideScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot find function submitFields in object standard record. (/SuiteScripts/workflow/wf_print_log.js#28)
1
s
you probably want to use set field value otherwise you'd be using record.submitFields not newRecord.submitFields record as in from N/record not the record in context
m
Hi Thanks a lot newbie in suitescript its in the small things. Thank you one more time 🙂