Hi Everyone, what is the internal ID for sublist? ...
# suitescript
k
Hi Everyone, what is the internal ID for sublist? Where can I get the internal ID for sublist?
Copy code
salesOrder.setCurrentSublistValue({
                sublistId: 'item',
                fieldId: 'item',
                value: '43535353343535'//internal id 
            });
w
on your example above - the value should be the Internal ID of the item.
c
If you open the form with the sublist, and add &xml=t to the end of the URL, you can usually find the ID in the xml of the form. For custom sublists they start with “rechmach”
k
ah
Is fieldID equivalent of Key from JSON?
c
fieldId is the ID of the sublist field. You need both the sublist ID and the ID of the field you are trying to modify
k
Hmm, i have a script that returns a json of the information of a sales order What key do I look at? I’m looking into the XML but it looks similar to the JSON?
c
I don’t follow. are you trying to modify the items sublist on the sales order?
If so, you need to specify the id of the field on the transaction line you want to modify
k

https://files.slack.com/files-pri/T29A3EDK8-F02MG4ZKA8Y/screen_shot_2021-11-09_at_3.50.22_pm.png

Im trying to remove an item
and add another item
using suitescripts
c
On a client script? Meaning are you trying to modify it using N/currentRecord?
k
I’m using N/record
I am new to suitescript so I am not familiar much with the fieldID and SublistID.
Copy code
var salesOrder = record.create({
            type: record.Type.SALES_ORDER,
            isDynamic: true,
            defaultValues: {
                entity: 123242440099
            }
        });

salesOrder.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'item',
            value: '4353535334535'//internal id 
        });
I am not familiar with entity of the record create method, and value of the sublist value. Is these value generated or I need to find it somewhere in netsuite?
c
salesOrder.setSublistValue({ sublistId: ‘item’, fieldId: ‘item’, line: 0, value: 6 })
You already have the id of the sublist, and the ID of the field there
k
Ohh, i see! SublistID is the blue? FieldID is the bottom white?
What about the value?
c
Value is the ID of the item you want to set
See the schema:
k
Is it the id in the endpoin
Copy code
app/common/item/item.nl?id=44
For the value?
c
message has been deleted
k
Ah! The fieldID is basically the key of a json that is pass back when I send a record back via restlet
OHH!
i get it
thank you!
👍 1
Hi Cory, I am getting
Copy code
"Please enter value(s) for: Sales Channel","stack":
But i do not see a sales channel id
Hi nevermind found it
s
FWIW, the result of
JSON.stringify(somenetsuiterecord)
is not something you can depend upon as that output is undocumented and unsupported.
in other words, avoid
JSON.stringify(someNetSuiteRecordInstance)
👍 1