Is there a way for me to get a sales_order by tran...
# suitescript
k
Is there a way for me to get a sales_order by tran_ID? I can only think of searching for ID of sales_order Then search the record with the resulting ID
b
keep in mind that tranid is not unique
but otherwise you do a search or query that has a filter on the tranid
k
I see, I was hoping i didn’t need to run 2 different functions to get sales order.
Currently I use search module to get the ID then run a record to get the sales order
Was hoping I can use only record module to search by tranId
b
the record module only can load records via internal id
k
Oh! got it
thank you
Hi battk, I want to make a post request with a body containing 1700 objects. I am getting SSS_USAGE_LIMIT
Do you know what is the limit for a post body request for netsuite?
b
_SSS_USAGE_LIMIT_EXCEEDED?_
k
I am probably POSTing a body too big. I made the body smaller and it worked again
b
its more likely that you ran out of points
k
Oh, what are points in a body?
b
k
1000 records
hmm
let me look into it
thank you
b
if you still think its related to the size of the body, then: SuiteScript 2.x RESTlet Governance
👍 1
k
Hi battk, Do you have any way that I can use to change an item inside a sales order?
b
what have you tried?
k
Copy code
var itemCount = salesOrder.getLineCount({
        sublistId: 'item'
    });
    var currentLocation = salesOrder.getValue({
        fieldId: 'location'
    });

    for (i = 0; i < itemCount; i++) {
        salesOrder.selectLine({
            sublistId: 'item',
            line: i
        });
        salesOrder.setCurrentSublistValue({
            sublistId: 'item',
            fieldId: 'location',
            value: currentLocation,
        });
        salesOrder.commitLine({
            sublistId: 'item',
        })
    }
Copy code
record.setSublistValue({
            sublistId: 'item',
            fieldId: 'location',
            value: location,
            line: line
          });
I looked into this slack and someone wants to change the location of all item to “filler”
But I was unsure if that is a way
If i want to change any information in sales order
what kind of syntax do i need to use?
b
is the usual choice, unless you are using dynamic mode
which the help for that method also documents
👍 1
k
thank you
Hi battk, I have Sublist containing object: “Item”:{ “currentline”:{ }, “item1”:{ } }
I want to change information inside line 1
How can I set the value of “line 1”
I am not sure if this is a correct way
Copy code
var salesOrderData = record.load({
            type: record.Type.SALES_ORDER,
            id: salesOrderID
        })

        log.debug('BEFORE Sale order Data', salesOrderData)

        
        salesOrderData.setSublistValue({
            sublistId: 'item',
            fieldId: 'item',
            line: 0,
            value: {
                "test":"test"
            }
        });
b
what type of field is an item?
k
message has been deleted
Forexample I want to edit this tab inside sales order
We have different items with skus on there
I want to remove 1 SKU and add another one to replace it
b
go through the Field Type Descriptions for Custom Fields to learn about the different field types
maybe even create different custom fields of different types so that you can recognize the different field types
then tell me what type of field the item field is
k
I see how can i determine what field type my item is using?
I have the fieldID and everything but don’t know how to determine what field type my sublist is using
Actually I found it
b
usually its a visual identification sort of thing
if you really want to, the programmatic way is Field.type
k
The programmatic way makes more sense
Actually I still need help on where sublistID is located at
b
i personally just load the record in the debugger so that I can inspect the record
if you are using your browser's debugger, you need to use the .toJSON method of the record
alternatives include SuiteScript Records Browser
k
Oh got it, but Where is this debugger? are you talking about log.debug?
b
k
Hi battk, what are the entity inside fields from my record.load(type: Sales order)
For example I saw a code to create sales order but there is a entity key inside the defaultValues object function onRequest(){ var order = r.create({ type:r.Type.SALES_ORDER, isDynamic: false, defaultValues: { entity: 75 } } } ``````
Nevermind i got it