I also tried without creating in dynamic mode usin...
# suitescript
k
I also tried without creating in dynamic mode using
setSublistValue
and get the same error but on save instead of on commit line
a
you have dynamic and non-dynamic switched... or at least how you typed it here they seem to be swtiched... the xxxCurrentxxx sublist api calls are for the dynamic the raw setSublistValue api calls are for static regardless what you have in terms of code should be fine, and its not complaining about static/dynamic, its complaining about your account id you're sure the account internal id is 1221 ... as opposed to the account NUMBER ?
disregard the mode switching comment I missed the "without" 🙂
r
I would try setting it to a hardcoded value that you works, just to make sure your API call is working. If the hardcoded value does not work, the error might be related to a different field. I would also try simulating in the UI the record the script is trying to create.
☝️ 1
t
have you tried creating the JE in the UI with the values you are setting in your script to see if that account is showing in the account field list?
👍 1
k
Good suggestions. The 1221 is a hard coded internal I'd after the ones looked up in the script failed. I'll try in the UI in the morning.
c
Are you making sure to use the integer value of 1221 instead of a string?
k
The problem was subsidiary. While the subsidiary was in my data, it wasn't passed on to the reduce stage so it was trying to set account without the subsidiary defined.
Odd that it wouldn't throw an invalid subsidiary error
a
did you have a try/catch in your reduce stage? map and reduce stages wont stop on errors
catch... and log in your reduce stage?
oh you mentioned an error message already, disregard 🙂
k
yeah everything is wrapped in try / catch, but the sub was just not getting passed
I think when it just threw the account error first and there would have been a subsidiary error underneath but it stops execution
the rest of that block doesn't run once it hits the catch
so it only gives the first error