hi guys, getting a error TypeError: Cannot read pr...
# suitescript
a
hi guys, getting a error TypeError: Cannot read property "length" from null (update_deposit_application.js$188712#19) The script is just to Edit/Save the Deposit Application function updateDAStatus(){ var depApp = nlapiSearchRecord("transaction",null, [ ["type","anyof","depositapplication"], "AND", ["datecreated","onOrAfter","2021/12/01 12:00 am"], "AND", ["amountremaining","greaterthan","0"] ], [ new nlobjSearchColumn("internalid").setSort(true) ] ) //var depAppSearch = [15613395, ]; var resultGet; var Id; nlapiLogExecution('DEBUG','depApp.length',depApp.length); for(var i=1;i<=depApp.length;i++){ /*resultGet = depApp[i]; Id = resultGet.getId();*/ Id = depApp[i]; //nlapiSubmitField('invoice',Id,'taxitem','625069'); var depRcd = nlapiLoadRecord ( 'depositapplication , Id' ); var depId = nlapiSubmitRecord ( depRcd , false , true ); nlapiLogExecution('DEBUG','Id updated',depId); } } What am I doing wrong?
j
Perhaps your search returns no results?
a
thanks @jen doing the same in Prod where there are results
b
depositapplication is not a valid type for searches
make the search in the ui first, then load the created search in code and inspect its filters
a
@battk I did and found the deposit application on the records browser
the search works in UI
message has been deleted
b
load it in script
then log the filters
the ids of the types do not match the ids of the record type
a
@battk any other way you think I should approach this?
b
you can continue to try and guess the id
or you can try looking on suiteanswers
a
i see
thanks