This message was deleted.
# suitescript
s
This message was deleted.
a
You have a problem with the single quotes and concatenation here: • id: ''4', '2', '3', '5', '6', '7', '8'..... (review and fix this long string) FYI: I'm not sure why you are using third-party software to get exchange rates, NetSuite can do that natively: • https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4358551775.html
☝️ 1
I hope your access key is not the real thing, if it is please remove it: • var apiUrl = 'https://api.currencylayer.com/historical?access_key=XXXXX&%20date=05-02-2024';
h
Am getting Syntax error: missing } after property list
s
I think you should check the record.submitFields. id must be single
h
Those are internal ID's of Currencies
b
Copy code
''4', '2', '3', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '16', '17', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', ''45', '46', '47', '48', '49', '50', '51' + currencyCode',
is messed up real bad
there are extra quotes, and thats not actually an array
whatever you are using as a code editor is not properly configured for javascript, this is something that is easily caught by actual code editors
as others have mentioned, fixing the syntax error wont actually help you, you are using record.submitFields wrong, it does not accept multiple ids
h
I thought that, I should give internal Id for each Currency.
b
go read the documentation that was provided to you to see how record.submitFields works
h
Sure. Thank you
t
I could be wrong but I don't think record.Type.CURRENCY_RATE, is a valid enum, and currency exchange rate is one of those that you can't use the N/record mordule to do... I do think however you can use N/task to trigger a saved csv import instead
t
Not to pile on, but the date format for that API is YYYY-MM-DD. In your script, it's being set using this format: MM-DD-YYYY So the URL should be: https://api.currencylayer.com/historical?access_key=REDACTED&%20date=2024-05-02 And as someone mentioned above, you have exposed your CurrencyLayer API key. You might want to consider changing it.