Hi, we are trying to build a suitescript that will...
# suitescript
k
Hi, we are trying to build a suitescript that will allow us to input the text value from a customList instead of the internalID - Is this possible?
n
You'll need to expand on that. "Input" how?
n
I believe you want to set the value using the "Text1" in your script for a list that has values like these: 1. value: 1, text: "Text1" 2. value: 2, text: "Text2" 3. value: 3, text: "Text3" Is that the case?
n
^^ that still includes the internal id???
n
It does but the internal IDs are not known or they don't want to rely on internal IDs.
n
OK well I'm confused by your answer and what they are trying to achieve so I'll bow out, I must be missing something. 🤔 It's possible they actually want to use text in a CSV import for all I know, only clue is it's asked in SuiteScript which is not necessarily indicative 🙂 @Kushington post more detail if you want help or if that resolves your question please.
n
In summary, they want to use setText instead of setValue
and this is all my understanding. @Kushington hasn't responded.
k
hi both, thanks for your replies We have the following condition that would only take InternalID as the input - We know the name of the value in the list and would prefer to pass that instead of the InternalId
Copy code
if (datareceived.freightforwarder != null) {
                    filterArray.push("AND");
                    filterArray.push(["custcol_freight_fwder", "is", datareceived.freightforwarder]);
                    log.debug("freightforwarder is provided: " + datareceived.freightforwarder);
                }
otherwise we have to have the mapping of the internal Id elsewhere
That is only part of the script - the part of the code that sets datareceived is:
Copy code
function doGet(requestParams) {
            var datareceived = JSON.parse(JSON.stringify(requestParams));
n
If you know the record that the list appears on, you can do record.create and getField and from that getSelectOptions which would give you the internal id and text in the format Nick mentioned. You don't have to go on to create the record the object can be discarded.
💯 1
k
Thanks @NElliott - I'll take a look at that function, haven't used it before!