I'm going to try asking this a different way. In ...
# suitescript
a
I'm going to try asking this a different way. In the attached snippet I have the json that is being sent and restLet that it's being sent to. In this case it's being sent to the POST function. The Project/Job record is created but the only field that seems to be populated is
companyname
and
recordtype
. All of the other fields are left empty or get a default value. Slack Conversation
d
@Andy Kallio have you put any debugging into your for(var fldName loop?
I suspect your problem is in that area, maybe naming mismatches or something is not functioning in that loop properly to be able to get to rec.setValue
b
hope you noticed by now, but your for loop is missing braces
👍 1
a
Thanks for these suggestions. I am a salesforce developer with little javascript experience. The code was simply taken from Netsuite's restlet examples and seems to work well in making a customer record.
s
@Andy Kallio best of luck to you. I was a former Java developer, then Salesforce developer, then Groovy and NetSuite. It helps to use a "linter" to help catch common mistakes or static code issues. They will help you find issues like missing braces. A code formatter will also help keep your code neatly indented and organized. Also, take any code examples from SuiteAnswers with a heavy dose of salt. Don't even assume they work or have been tested. I have seen numerous examples where the code was just plain wrong. It's a good guide, but sometimes misleading.
a
The problem was definitely due to the missing brackets. Thanks!
b
And now you know why i brace everything