Hey sorry if this is a dumb question since I'm a t...
# suitescript
r
Hey sorry if this is a dumb question since I'm a total noob and I'm trying to do this based on patterns in existing code and Google, but I think my issue is that my lotNum and lotNumQty variables (that I added to the existing code) aren't saving and I'm not sure why. The bot's answer doesn't make sense to me. Code in ๐Ÿงต~.~ Removed for now
a
you didn't provide the reduce function, that's the part that actually does a write back to NS so if you didn't modify that too then I don't think anything is going to be updated. you should log
lotNum
and
lotNumQty
to validate they have the values expected at the end of the map stage or you could just log
valueObj
... you can also just parse the context at the start of the reduce stage and just log there instead.
r
you can also just parse the context at the start of the reduce stage and just log there instead.
I think that's what this is doing, right? This is the beginning of the reduce function that ultimately contains the code in the most immediate comment.
a
i don't see any logs
have you confirmed your code is settign values for your 2 new variables
where are you loading the vendor bill? what's the line of code that starts
var recVendorBill =
this is chatGPT code?
it looks right , but is wrong in weird ways and its always hard to debug
kind of a hallmark of chatGPT code I've found
r
have you confirmed your code is settign values for your 2 new variables
No. I tried to stumble through using the Debugger to figure this out, but was not successful. I saw the documentation explicitly states M/R scripts don't work in the Debugger, so I was trying to post relevant snippets to it and couldn't get it to work enough to figure out if those variables are getting set.
Not chatGPT. A human from like 6 years ago
But it was NSPS, so.....
a
LOL
umm you can still use LOGS I wasn't talking about the debugger
Copy code
log.debug({ title: 'checking my lot var', details: lot});
selectNewLine only works in dynamic mode so the record wouold have to be loaded in dynamic mode, if it wasn't then that might be your problem
r
Ok this question will for sure show how little I know about this stuff, but where would I find those values when the code runs? I thought it would be on the Execution Log on the Deployment record, but there are some other fields being logged and I don't see them there.
a
right that's exactly where you check, but you have to add that debug line to your code so it writes the log when it runs
r
Copy code
var recVendorBill = record.create({
            type: record.Type.VENDOR_BILL,
            isDynamic: true,
            defaultValues: {
                entity: keyObject.vendor
            }
It's using dynamic
a
ok well that's likely not the issue then k so you're not a dev? but you're writing code for a MR script? that's brave ๐Ÿ˜„ this is gonna require a lengthy conversation, and I have to join a call, so I can't help you right now
r
right that's exactly where you check
Add this in the Map section? That's part of my confusion I guess becuase there are other fields (the code for which I haven't touched) that have a log function attached, but I'm not seeing those values in the Execution log. Presumably they should be showing there right?
a
yeah they should if that code is running
there's a log level field on the script deployment, you might need to set it to debug
r
so you're not a dev
Nope. Just a guy who knows a tiny little bit about how coding works and who owns this process in general, so I'm seeing if I can just make minor changes. It's looking like that's not the case.
there's a log level field on the script deployment, you might need to set it to debug
Oh that's right. I've dealt with that before.
a
nothing wrong with you not being a dev, but it changes how I have to formulate my answers ๐Ÿ˜„
r
Hey I very much appreciate your time/help, but I wouldn't expect you to hop on with me. I don't have a dev budget for this at the moment and I wouldn't want you to spend more time for free than you already have. You've given me some more troubleshooting to try, and that's enough for now! Thanks!
a
lol i dont do this to get paid, just reply again later when you get stuck I'll see the notification and I can take another look
r
I'll keep that in mind. thanks again!
Deleting code snippets for now. It's really nothing that sensitive or I wouldn't have put it here in the first place, but ya know..paranoia.
a
lol yeah there was nothing there you need to worry about
r
I dunno, I expect the code written by NSPS is in high demand. wouldn't want to kill their business.....
Hey @Anthony OConnor really appreciate your input/help, especially noting the logging and reminding me you can see that info via the Script Deployment. Turns out I was overthinking by trying to use the Script Debugger and banging my head against the wall trying to get that to work how I wanted. Anyway, I think I solved my issue. Turns out troubleshooting is way easier when you can see what's actually happening versus taking educated guesses. I also had an unrelated problem in that one line of the code I copied from Oracle documentation was wrong. I only looked at that line approximately 50 times before noticing it. Thanks again, cheers!
๐Ÿ‘ 1
a
cool, nice job man, happy to help
thankyou 1