Untitled.js
# suitescript
c
Untitled.js
a
what's
newCreditLine
? what does
customLines.addNewLine();
return?
c
it's a custom line on the GL
c
What does the function header look like? Does it have customLines as a parameter and its spelled the same? Your code looks OK for the GL Impact
c
This code works 99% of the time
I'm getting this error for this one transaction
a
i mean what datatype, and does it have a
setLocationId
method
ahh
what's the actual value of the location?
c
it rreturns a CustomLine object that has those methods on it @Anthony OConnor
c
FYI: This is a customGL script
well.. customGL plugin
šŸ‘ 1
c
your code is valid but why customLines is null unless there just are no customLines for this transaction.
a
newCreditLine.setLocationId(parseInt(invoiceData[i].getValue('internalid', 'location', null),10));
if there's a leading 0 parseInt can assume octal - i think that's been fixed in all JS engines now though?
c
internal ID is 658
c
nah its not even getting that far. Its bombing on the function call itself that setLocationId does not exist on a null object
c
so no leading zero.
not sure why I can't create a new line?
c
If you hardcode a location does it work just for curiosity
c
good shout, will test
c
i'd actually expect the other 2 lines to fail too if its a null object
a
right, that's what i was thinking too
c
actually all of it to fail
you may be right and i'm totally wrong here @Anthony OConnor was not on the same page but am now
a
yeah idk, this is a weird one
c
it looks like newCreditLine is null
no idea how that can be
c
yeah not sure why setAccountId or setCreditAmount isn't failing
c
Hardcoding the internal ID did not work, which makes me think you were right with the failure to create the line.
c
unless your parameter is not customLines but you said it works other time so probably not that
a
cos they're just passing values not making an api call maybe??
c
Would logging the result of customLines.addNewLIne() show anything interesting?
a
umm you just said it was null?
c
That was wild speculation, I'll know in a second
a
oooooohhh lol
c
nlapiLogExecution('DEBUG', 'new line value', newCreditLine);
empty/blank
a
ok well i guess that's some kind of answer
c
it matches the example just fine. The document doesn't say anything about why it would be null. Unless the lines just aren't available would be my guess. Only a guess because we don't have any insight into the why
c
I smell a bug
which will be impossible to validate with support.
a
you have
customLines
to reference? and its of the correct data type?
I don't think this can be a bug on the NS side - this isn't an edge case, its basic addNewLine functionality - I don't see how that can be bugged
(I've literally never used the customGL plugin, but I stand by what I've said šŸ˜‚ )
c
Wish me luck!!!
@Anthony OConnor the log for the customline was blank
For thousands of other transactions today, that line of code worked
even for transactions using the same location ID.
All I can do is ask SuiteScript 1 to create a new line, if it doesn't create one, I don't see how that can be a scripting error?
s
Yes, sadly, I have to say; in my experience just because it seems like normal behavior doesn't mean NS isn't still the source of the problem. (referring to @Anthony OConnor’s comment)
c
I think the CustomGL plugins are still running on the old JS engine (rhino/SS1), it wouldn't surprise me to see odd defects.
a
godspeed @Craig