I have created custom record
I am entering data in this custom record. There is user event script written aftersubmit event.
After submitting custom record, i am creating Write check record through script, bt its not allowed me to set Check(tranid) field. Getting error - ReferenceError: "value" is not defined. (NLRecordScripting.fieldChange.f.tranid#3)
I think using script we can not set check (tranid) field...... Is it?
For information please refer my code also
function CreateWriteCheckEntry()
{
//Begin: Getting details form custom record
var headerAcc = nlapiGetFieldValue('custrecord_txn_entry_import_acc');
var vendorId = nlapiGetFieldValue('custrecord_txn_entry_import_payee');
var headerMemo = nlapiGetFieldValue('custrecord_txn_entry_import_memo');
var checkNum = nlapiGetFieldValue('custrecord_txn_entry_import_check_num');
var tranDate = nlapiGetFieldValue('custrecord_txn_entry_import_date');
var tranID = nlapiGetFieldValue('custrecord_txn_entry_import_tranid');
var locationId = nlapiGetFieldValue('custrecord_txn_entry_import_locn');
var classId = nlapiGetFieldValue('custrecord_txn_entry_import_class');
var costCenterId = nlapiGetFieldValue('custrecord_txn_entry_import_cost_ctr');
var notes = nlapiGetFieldValue('custrecord_txn_entry_import_notes');
var lineMemo = nlapiGetFieldValue('custrecord_txn_entry_import_memo_dtl');
var LineAccId = nlapiGetFieldValue('custrecord_txn_entry_import_acc_dtl');
var LineAmount = nlapiGetFieldValue('custrecord_txn_entry_import_amt_dtl');
//Begin:Write check entry record creation
var writeCheque = nlapiCreateRecord('check');//, {recordmode: 'dynamic'});
writeCheque.setFieldValue('account',headerAcc);
writeCheque.setFieldValue('entity',vendorId);
writeCheque.setFieldValue('memo',headerMemo);
writeCheque.setFieldValue('custbody_note',notes);
nlapiLogExecution('DEBUG','CreateWriteCheckEntry', ' checkNum - ' + checkNum);
writeCheque.setFieldValue('tranid',checkNum); //getting error at this line: if this is commented check created successfully
writeCheque.setFieldValue('trandate',tranDate);
writeCheque.setFieldValue('location',locationId);
writeCheque.setFieldValue('class',classId);
writeCheque.setFieldValue('department',costCenterId);
writeCheque.selectNewLineItem('expense');
writeCheque.setCurrentLineItemValue('expense','account',LineAccId);
writeCheque.setCurrentLineItemValue('expense','amount',LineAmount);
writeCheque.setCurrentLineItemValue('expense','location',locationId);
writeCheque.setCurrentLineItemValue('expense','class',classId);
writeCheque.setCurrentLineItemValue('expense','department',costCenterId);
writeCheque.setCurrentLineItemValue('expense','memo',lineMemo);
writeCheque.commitLineItem('expense');
var idWC = nlapiSubmitRecord(writeCheque,true, true);
}
Please help me on this.