What's the best way to get the internal ID of a cu...
# suitescript
c
What's the best way to get the internal ID of a custom list value in SuiteScript? (points given for the worst way too because I haven't figured out any way).
e
Probably need more context
Otherwise, "do a search" is about the best I can think of
c
Can't do a search for custom lists. NS limitation.
Gimem a sec to write out the scenario.
e
Do you want the ID of a value in a list? Or the ID of the List?
c
value
• I have a remote service that sends Return Auth data to NS. • The payload includes a STRING representing a reason for the customer return • There is a custom record in NS that has return reasons, these reasons do not map to the remote services reasons • I added a field (list) to the custom reasons record so I can map the remove services reason STRING to the existing custom reason
e
You can absolutely search a custom list
šŸ‘€ 2
šŸ’Æ 2
c
When the service sends me a return, I want to take their reasons string and map it to the custom reasons record to get a value I can enter into the RA.
e
To get the
name
and
id
of each option:
c
Is it possible to construct a similar search in the UI?
I was getting : An nlobjSearchFilter contains invalid search criteria: value. So thought I'd build this search in the UI then use the 'export search' plugin to get the code. I couldn't find how to do it in the UI and that's when someone tol me it's not possible to search custom lists.
Looks like you've proven them wrong
e
Unsure, but I don't see anything in the UI
c
Maybe it's just a restriction on the UI side.
e
If I had to guess, the data model is probably a subset of the Custom Record search object. That's just a guess though
c
I changed
Copy code
['value', 'anyof', reasonCodesFromSuperSecretApi]
to
Copy code
['name', 'anyof', reasonCodesFromSuperSecretApi]
and have progressed to : An unexpected SuiteScript error has occurred šŸ˜„
That's forward progress I guess
Untitled.js
I'm trying to do this
e
What's
reasonCodesFromSECRETApi
c
You're right - anyof should be is
Thanks for the rubber ducking!!
āœ… 1
s
personally, I do list searches like this with SuiteQL for speed and simplicity.
šŸ’Æ 1
e
ā˜ļø Second