Has anyone ever experience an occurrence where Net...
# suitescript
e
Has anyone ever experience an occurrence where NetSuite will convert a script variable from an Integer type to a Floating point? I see this happen every now and then during a script that sends an email then updates a checkbox on the Sales Order record that the email was sent. In this scenario, NetSuite converted the script variable SalesOrderId from 2581254 to 2581254.0
e
Yeah I see this from time to time, though I haven't ever investigated to narrow down a cause. The only advice I have is to ensure your script consistently parses, stores, and operates on the value in memory as a
number
, then all your display mechanisms for the value force the
integer
format (e.g. in an email template with something like
${myNumber?floor}
).
s
We have the exact same problem. It is intermittent. It doesn’t happen all of the time, not even most of the time, but occasionally. The difficult part is that it sometimes impacts scripts from a bundle that we cannot change or fix ourselves. Today, this issue impacted one of the scripts from the Fixed Assets Management bundle, and we got an INVALID_NUMBER error Invalid number 1.0 It’s on the latest version, so I don’t know what else we can do to avoid this. Is NetSuite aware of this? We can contact support, but that is going to suck up a lot of valuable time.
e
I submitted a support case today so hopefully that goes some where. But I have gone as far as even when performing record.submitFields, forcing the recordID into an int
example
Copy code
record.submitFields({
    type: record.Type.SALES_ORDER,
    id: parseInt(salesOrderID),
    values: {
        custbody_step_softw_del_email_complete: true,
        custbody_resend_software_delivery: false,
    },
    options: {
        enableSourcing: false,
        ignoreMandatoryFields: true
    }
});
e
We didn't go down the support route because of the amount of time it would involve. We haven't seen it in NS bundles yet, but I don't know how many of those scripts are in 2.1. We force the id to a string.
parseInt(id, 10).toString();
🤔 1