https://netsuiteprofessionals.com logo
Join Slack
Powered by
# suitescript
  • f

    FAgudelo

    07/29/2025, 7:45 PM
    My purchasing department is always changing the total amount in a PO and the difference needs to go through an approval process. Any suggestions on what to do here they usually change the PO amount 12 times .
    m
    r
    e
    • 4
    • 6
  • n

    netsuiteforstrongmen

    07/30/2025, 8:44 AM
    Hello, I am working on a script to create and edit Vendor Bills / Purchase Orders under the SuiteTax Engine. For example, consider a document with two items: • SuiteTax Bullet 1 — assigned Tax First • SuiteTax Bullet 2 — assigned Tax Second Each item has its own tax When I create the document via script, everything works as expected — both items are added, and the taxdetails sublist contains correct taxcode, taxamount, and taxbasis values. When I edit the document and remove one of the items, it works correctly as well — the corresponding tax line is removed and totals are updated. However, when I edit the document and add an item (e.g., adding SuiteTax Bullet 2 back), I encounter an error: You have entered an Invalid Field Value 23667 (Tax Second) for the following field: taxcode This occurs even though the same taxCode (ID 23667 for “Tax Second”) works fine during initial creation.
    Copy code
    let document = record.load({ type: documentType, id: requestBody.id, isDynamic: false });
    Copy code
    if (isSuiteTaxEnabled) {
        document.setValue('taxdetailsoverride', true);
    }
    
    items.forEach((item, index) => {
        if (item.taxCode !== undefined && item.taxCode !== null) {
            document.setSublistValue({
                sublistId: 'taxdetails',
                line: index,
                fieldId: 'taxamount',
                value: item.taxAmount,
            });
    
            document.setSublistValue({
                sublistId: 'taxdetails',
                line: index,
                fieldId: 'taxbasis',
                value: item.amount,
            });
    
            document.setSublistValue({
                sublistId: 'taxdetails',
                line: index,
                fieldId: 'taxcode',
                value: item.taxCode,
            });
        }
    });
    Thank you in advance for your support.
    g
    m
    • 3
    • 7
  • z

    Zoran R-DATAGRAM

    07/30/2025, 10:47 AM
    Hello, I would like to make a validation script when the user import a Journal Entry. First idea is creating UE BeforeSubmit and if validation fails, I will throw an error. But, I would like to reference exactly line where are invalid data. It will be ideal if the user got results can see what is error. Is it sound that "client script" and validate line can somehow used?
    g
    a
    e
    • 4
    • 6
  • n

    Nicolas Daniel Villalba

    07/30/2025, 3:22 PM
    Hi everyone, I'm looking for the best practice in SuiteScript 2.1 for a performance issue. The Challenge: I have a script that needs to apply a payment to a specific invoice for a customer with over 35,000 open invoices. The Problem: Creating a payment from the customer record using
    record.create
    or
    record.transform
    fails. Both methods try to load all open invoices into the
    apply
    sublist, which hits the ~10,000 record governance limit. This makes it impossible to find and apply the payment to the correct invoice if it's not in that first batch. Failed Attempts: • Loading the Payment: Fails due to the 10k limit. • Loading the Invoice: Fails due to a timing issue (the invoice doesn't "see" the newly created payment to apply it). What is the recommended architecture for this scenario? Thanks for your help!
    a
    g
    +2
    • 5
    • 10
  • a

    Armanda

    08/01/2025, 1:58 AM
    Hi everyone, I have a question: what's the best practice for creating a sublist? I tried using savedSearch as a sublist, but when I tried to use the parent record lineCount in the userEvent, no data was found. I also tried creating a field of type list/record and checking isParent. Then, any child fields related to this parent field would appear in the parent record. However, I can't access them directly from the parent record in SuiteScript. So, I used the N/Search module for the Child type and then filtered the appropriate parent. Is there another way? Thank you.
    n
    • 2
    • 1
  • d

    David Na

    08/04/2025, 7:18 AM
    sendRedirect to suitelet is not working I have external suitlet with login authenticator, after user will put credentials he will redirect to the same suitlet but in different context (using parameters to know what context he will get, need to log or already logged) i get "*Invalid page parameter. Unable to view page.* " Netsuite error.
    Copy code
    response.sendRedirect({
                                type: 'SUITELET',
                                id: 'customdeploy_tpp_su',
                                identifier: 'customscript_tpp_su',
                                parameters: {
                                    custparam_action: 'dashboard',
                                    custparam_sessionid: sessionId
                                }
                            });
    All IDs, are ok. Suitlet is "Available without login"
    n
    b
    • 3
    • 4
  • s

    Shelby Owens

    08/05/2025, 3:11 PM
    I am trying to create a script that when a custom button is selected on specific Cases, it looks through a sublist of custom records (which holds item, quantity, price, and other info) and creates a Quote using those custom records to populate the line items. I have been trying to perform this so when the button is clicked a function is performed from a client script in the file cabinet, but anything more than 5 items can take more than 30 seconds to load, and causes the browser to show NetSuite as unresponsive, which is not what my requester wants. Am I going about this in the right way? Is there a way to avoid the long load time or have it work in the backend so the user can still work? I am newer to SuiteScript so any assistance is appreciated! (Code in comments)
    g
    • 2
    • 4
  • c

    Chris

    08/05/2025, 3:37 PM
    Using
    record.copy
    , is it possible to edit the subsidiary on the resulting pre-filled form?
    n
    a
    • 3
    • 3
  • t

    Ty

    08/05/2025, 5:45 PM
    In a user event script, is it possible to set transaction sublist values where other values automatically calculate, like they do in the UI? I need other values like amount and tax details to automatically calculate. I am doing this logic when a record is transformed. Doing this through a client script works but I need this to work when transformed in bulk through a suitelet, where I think client scripts wont run on the newly transformed records. It's my understanding user event scripts are always in standard mode. How should I handle this?
    r
    • 2
    • 4
  • p

    Prashant Kala

    08/06/2025, 5:20 PM
    We use transform to create bill out of purchase order. As per our requirement we need to bill two purchase orders. So I transformed the POs into two bills and now merging them. If the bill has inventory detail, I am not able to copy/create the inventory assignments for serialized/lot numbered items. It is created properly in one bill but when i try to copy it to another bill, it does not work and fails saying serial number/lot number is required.
  • c

    Craig

    08/07/2025, 11:00 AM
    Is there a way to map the Account Type field (on an Account) field text to the field value? On the Account record UI, the Account Type field has the following value: Other Current Asset but the Chrome record browser plugin shows the value as OthCurrAsset. I am importing Account fields from a database and creating the Account records via NS. The database has Other Current Asset but it doesn't know about the internal value record.setText('Other Current Asset') did not help so I assume I have to record.setValue('OthCurrAsset') but I obviously need a map.
    • 1
    • 1
  • j

    JC

    08/07/2025, 12:40 PM
    Anyone know what's with all the
    Notice (SuiteScript)
    errors recently? I've seen those across 4 accounts already.
    n
    • 2
    • 5
  • j

    JBL

    08/08/2025, 1:58 AM
    is it possible to extend the time that the the vscode suitecloud extension stays signed in?
    m
    • 2
    • 5
  • p

    Pradeep Kumar

    08/09/2025, 7:37 AM
    How to make emirate, country and place of supply without row height? i am rendering in suitelet pdf. I need like the reference image i attached. And the output image is output for this below code. can anyone please help me out with this? Here is the code snippet i used in suitelet. <table style="width:45%; border:none; border-collapse:collapse; margin:0; padding:0;"> <tr> <td style="width:60pt; border:none; padding:0; line-height:7pt;">Emirate</td> <td style="width:5pt; border:none; padding:0; line-height:7pt;">:</td> <td style="border:none; padding:0; line-height:7pt;"></td> </tr> <tr> <td style="border:none; padding:0; line-height:7pt;">Country</td> <td style="border:none; padding:0; line-height:7pt;">:</td> <td style="border:none; padding:0; line-height:7pt;">${buyerCountry}</td> </tr> <tr> <td style="border:none; padding:0; line-height:7pt;">Place of supply</td> <td style="border:none; padding:0; line-height:7pt;">:</td> <td style="border:none; padding:0; line-height:7pt;"></td> </tr> </table>
    j
    • 2
    • 1
  • e

    Emanuel V

    08/12/2025, 4:56 AM
    Hi folks. When creating a job (project), I am trying to update the project name as part of a userevent script. However, copying the template into the job takes a finite amount of time where the job is unavailable for field updates. Is there anyway to determine when the job is available for edits and I can execute the field update I require? I'd prefer if this happened in the same create process (or imeediately after) rather than run another script afterwards. Thanks.
    Copy code
    ""type":"error.SuiteScriptError","name":"_1_2_IS_UNDER_CONSTRUCTION","message":"Job ACME : 1078 To Be Generated : ACME is under construction!""
  • w

    William Rodriguez

    08/12/2025, 3:03 PM
    Who can help me change the log level in the Suite Tax Engine plugin?
    n
    m
    • 3
    • 2
  • e

    eblackey

    08/12/2025, 9:13 PM
    I was reading through the SAFE guide and came across this section on resaving a record in afterSubmit. This seems obvious, but the one place we do this - setting a record externalid value - doesn't seem to have a good workaround so I'm curious what others do.
    e
    a
    c
    • 4
    • 7
  • m

    Marvin

    08/13/2025, 6:55 AM
    Has anybody run into a case where updating a custom segment on a line triggered their deletion on an existing record? I checked all the user events scripts/workflows and nothing is deleting lines. It happened when a custom segment violated business logic. Mostly failed gracefully by preventing the save, but we found a case of one Item Fulfillment having all it's lines removed. I have not seen it documented anywhere of a case that lines would be removed. Isn't the expected behavior is that the save fails if the business logic fails and lines aren't removed?
  • s

    Sagar Hiray

    08/13/2025, 1:42 PM
    Hi All In NetSuite, there is a standard functionality to lock support cases after a certain period (Lock-Out Support Case). How can we check in SuiteScript whether a support case is currently locked out or not?
  • a

    Alexander Cuadros

    08/13/2025, 6:11 PM
    Hi everyone, regards, where can i find documentation about this: (*Mobile Configuration in wms roles), i want to now how works the element seetings (*After On Click Action RESTlet, On Scan Custom Action, Mandatory Condition, etc) , how does theses options work , or how i can customize with custom scripts the mobile operation
  • e

    ericbirdsall

    08/13/2025, 7:29 PM
    Has anyone played around with the new Custom Tool Script Type? https://system.app.netsuite.com/app/help/helpcenter.nl?fid=t_section_0724092648_1.html I'm following this guide, but it doesn't appear to work
    m
    a
    g
    • 4
    • 40
  • s

    Sim Greenbaum

    08/14/2025, 6:57 PM
    Does anyone have documentation for using secrets in NetSuite, kind of like an .env file
    e
    t
    b
    • 4
    • 10
  • n

    NSN

    08/14/2025, 7:22 PM
    Question: Can we get a file from S3 . using SuiteScript ? What do i need to get that. Secret KEy Bucket File name What else ?
    👀 1
    e
    i
    +3
    • 6
    • 12
  • e

    eblackey

    08/14/2025, 8:23 PM
    Does anyone know why NetSuite provides a scriptid field for custom record instances? It doesn't seem to be very useful as-is. It would be nice if you could use that value in a record.load as an alternative to the internalid, similar to how you can use the scriptid in a search.load.
    a
    j
    • 3
    • 9
  • a

    Abdul Qadeer

    08/15/2025, 9:44 AM
    Step by step guide to build custom tool for NetSuite AI Connector. https://www.linkedin.com/pulse/building-custom-tool-agent-netsuite-ai-connector-step-abdul-qadeer-fcg8f/
  • t

    Ty

    08/15/2025, 10:36 PM
    Im using the REST Api to transform a sales order into an item fulfillment and was wondering if there's a way to get information first before creating it. When creating the item fulfillment, netsuite automatically populates the inventory detail for some lines. When it does populate, i don't need to include anything in the json for inventory detail/inventory assignment because the quantity already matches. When it does not populate (due to some items not having default values), I need to include a json object in the request for the inventory detail. Is there a way to get information about what the created item fulfillment looks like before it gets saved? I need to figure out which lines I need to include an inventory detail for. Or would there possibly be a way to overwrite what the inventory detail is so I can always include it in the json body? I can't currently always include it because the pre-populated lines exist and give an error saying the quantity must match X.
    c
    y
    • 3
    • 4
  • l

    Luis

    08/17/2025, 4:19 AM
    Hi, I’m doing some testing in SB as I would like to override the shipping address on customer invoice on save. What am I missing in this script (see comments)?
    b
    • 2
    • 3
  • l

    Luis

    08/17/2025, 4:20 AM
    /**
    * @NApiVersion 2.1
    * @NScriptType UserEventScript
    * @NModuleScope SameAccount
    */
    define(['N/record', 'N/runtime', 'N/search', 'N/log'],
    (record, runtime, search, log) => {
    const beforeSubmit = (scriptContext) => {
    if (scriptContext.type !== scriptContext.UserEventType.CREATE && scriptContext.type !== scriptContext.UserEventType.EDIT) {
    `log.debug('Debug',
    Script did not run for event type: ${scriptContext.type}. Exiting.
    );`
    return;
    }
    const newRecord = scriptContext.newRecord;
    const subsidiaryId = newRecord.getValue({
    fieldId: 'subsidiary'
    });
    if (!subsidiaryId) {
    log.debug('Debug', 'No subsidiary found on the record. Exiting.');
    return;
    }
    try {
    const subsidiaryFields = search.lookupFields({
    type: record.Type.SUBSIDIARY,
    id: subsidiaryId,
    columns: ['country']
    });
    const subsidiaryCountryValue = subsidiaryFields.country[0].value;
    `log.debug('Debug',
    Subsidiary country is: ${subsidiaryCountryValue}
    );`
    if (subsidiaryCountryValue !== 'US') {
    log.debug('Debug', 'Subsidiary country is not USA. Exiting.');
    return;
    }
    const locationId = newRecord.getValue({
    fieldId: 'location'
    });
    if (!locationId) {
    log.debug('Debug', 'No location found on the record. Exiting.');
    return;
    }
    const locationFields = search.lookupFields({
    type: record.Type.LOCATION,
    id: locationId,
    columns: [
    'address1', 'address2', 'city', 'state', 'zip', 'country'
    ]
    });
    log.debug('locationFields ', JSON.stringify(locationFields));
    const shippingAddressSubrecord = newRecord.getSubrecord({
    fieldId: 'shippingaddress'
    });
    shippingAddressSubrecord.setValue({
    fieldId: 'country',
    value: locationFields.country[0].value
    });
    shippingAddressSubrecord.setValue({
    fieldId: 'city',
    value: locationFields.city
    });
    shippingAddressSubrecord.setValue({
    fieldId: 'state',
    value: locationFields.state
    });
    shippingAddressSubrecord.setValue({
    fieldId: 'zip',
    value: locationFields.zip
    });
    shippingAddressSubrecord.setValue({
    fieldId: 'addr1',
    value: locationFields.address1
    });
    if(locationFields.address2) {
    shippingAddressSubrecord.setValue({
    fieldId: 'addr2',
    value: locationFields.address2
    });
    }
    `log.audit('Success',
    Ship-to address updated from location record for Invoice ID: ${newRecord.id || 'New Record'}
    );`
    } catch (e) {
    log.error({
    title: 'Error copying location address',
    details: e.toString()
    });
    }
    };
    return {
    beforeSubmit: beforeSubmit
    };
    });
  • v

    Vishal Chaudhari

    08/18/2025, 2:05 PM
    Hi Everyone, I have installed the "Lot Auto Numbering" app, and when I create a Sales Order and fulfill it, the available quantity is not decreasing. Could this be because the good status is not showing in the Inventory Detail popup when creating the Sales Order, or might there be another issue? What could be the cause? Thanks!
  • a

    Arham Momin

    08/18/2025, 7:19 PM
    Hi, can anyone help me out? I want to get the field IDs of all the fields present on a Purchase Order (PO). I’m using
    recordObj.getFields()
    , but it only returns the IDs of fields that contain values. How can I retrieve all field IDs, including empty ones?
    a
    • 2
    • 6