hi i have the below code, but its not creating the...
# suitescript
v
hi i have the below code, but its not creating the journals as well i dont get the error log, please help me On this. try{ var journalRecord = record.create({ type : 'journalentry', isDynamic : true }); journalRecord.setValue('subsidiary',subsidiary); journalRecord.setValue('memo',matchingCode); journalRecord.setValue('approvalstatus',2); for(var i = 0; i < 2; i++){ journalRecord.selectLine({ sublistId : 'line', line : i }); if(i === 0){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'account', value : account, ignoreFieldChange : true }); if (amount < 0){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'debit', value : (amount * -1), ignoreFieldChange : true }); }else if (amount > 0){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'credit', value : amount, ignoreFieldChange : true }); } }else if(i !== 0){ if(amount > 0){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'account', value : 1389, ignoreFieldChange : true }); journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'debit', value : amount, ignoreFieldChange : true }); }else if(amount < 0){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'account', value : 1265, ignoreFieldChange : true }); journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'credit', value : (amount * -1), ignoreFieldChange : true }); } } if(division){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'cseg_bal_div', value : division, ignoreFieldChange : true }); } if(department && (department !== '- None -') ){ //log.debug('dep',department); journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'department', value : department, ignoreFieldChange : true }); } if(classs && (classs !== '- None -')){ //log.debug('class',classs); journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'class', value : classs, ignoreFieldChange : true }); } if(location){ journalRecord.setCurrentSublistValue({ sublistId : 'line', fieldId : 'location', value : location, ignoreFieldChange : true }); } journalRecord.commitLine({ sublistId : 'line' }); } var journalID = journalRecord.save(); log.debug('journalid',journalID); } catch { log.debug('err',e); }
c
What sort of script is this? You haven’t shared enough code to tell
v
its mr.
inside the map function
c
Have you logged at the start of the function to make sure getinputdata is passing data through?
v
yes it is.
n
You need to log the MAP errors in the summary section if you haven't already
Copy code
summary.mapSummary.errors.iterator().each(function (code, message) {
    log.error({title: 'Map Error : ' + code, details: message});
});
Something like this ^^ but you will need to check your context variables. (i.e. yours may not be called summary
v
yes i did and now i am able to get the error
👍🏻 1
thank you all