Custom GL Lines Plugin error due to a failed valid...
# suitescript
v
Custom GL Lines Plugin error due to a failed validation of script output: Setting entity on GL line with account of type AcctRec is not allowed for book-specific transactions. I get this error in my script? Could anyone please help? function customizeGlImpact(transactionRecord, standardLines, customLines, book) { var recordType = transactionRecord.getRecordType(); var recordID = transactionRecord.getId(); var subsidiary = transactionRecord.getFieldValue('subsidiary'); var dealType = transactionRecord.getFieldValue('cseg_type_deal'); var bookID = book.getId(); var lineCount = standardLines.getCount(); if((recordType === 'invoice' || recordType === 'itemfulfillment') && ((subsidiary === '3' || subsidiary === '17') && (dealType === '1'))){ nlapiLogExecution("DEBUG", "recordtype",'entering if'); for(var i = 0; i < lineCount; i++){ var currentLine = standardLines.getLine(i); var glEntityId = currentLine.getEntityId(); var glCreditAmount = currentLine.getCreditAmount(); nlapiLogExecution('debug','glcreditamount',glCreditAmount); var glDebitAmount = currentLine.getDebitAmount(); nlapiLogExecution('debug','gldebitamount',glDebitAmount); var glAccountID = currentLine.getAccountId(); var glMemo = currentLine.getMemo(); var glSubsidiary = currentLine.getSubsidiaryId(); var glPosting = currentLine.isPosting(); var glClass = currentLine.getClassId(); var glDepartment = currentLine.getDepartmentId(); if(glDebitAmount > 0 && glDebitAmount !== null){ var firstNewLine = customLines.addNewLine(); firstNewLine.setCreditAmount(glDebitAmount); }else if(glCreditAmount > 0 && glCreditAmount !== null){ var firstNewLine = customLines.addNewLine(); firstNewLine.setDebitAmount(glCreditAmount); } firstNewLine.setEntityId(glEntityId); firstNewLine.setAccountId(glAccountID); firstNewLine.setMemo(glMemo); //firstNewLine.setSubsidiaryId(glSubsidiary); firstNewLine.setClassId(glClass); firstNewLine.setDepartmentId(glDepartment); } } }
n
Try SuietAnswers, probably answer 102994
I'm reading: "You specified an account typeand entity type combination that is notallowed. Forexample, you specified a vendor with an accounts payableaccount, oracustomer with an accounts receivableaccount."
Ensurethat theaccount typespecified in setAccountId(accountId) "isappropriatefor theentity type"
I don't have any other answer I'm afraid.