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

    Luis

    08/20/2025, 12:26 PM
    Is it possible to set the shipping address in a customer invoice (sourced from the location address) on beforeSubmit? For some reason, I can’t make it work. It works for me only when I trigger it on afterSubmit.
    m
    • 2
    • 3
  • r

    Raj

    08/20/2025, 9:17 PM
    Trying to create Landed Cost Template records via script, but getting error:
    Copy code
    SCM_NON_UI_SCRIPT_CONTEXT: This record can only be created or edited through a user interface.
    Has anyone faced this? Any workaround?
    c
    y
    • 3
    • 3
  • l

    Lucas

    08/21/2025, 5:49 PM
    Is it good idea to make a "Fetch" calls from User event's injected HTML to NetSuite Suitelet? or will it case any issues??
    c
    • 2
    • 1
  • p

    Patrick

    08/22/2025, 1:43 PM
    Is there a way to manipulate the discount date on a bill? Instead of using the Days till Discount Expires?
    c
    • 2
    • 1
  • j

    jen

    08/25/2025, 4:21 PM
    Does anyone know if there is a way to call an internal URL of a page in NS from a script. My use case is that I want to “scrape” this page
    <https://XXXXX.app.netsuite.com/app/common/custom/itemoptions.nl?whence=>
    or ideally the actual CSV download link from that page
    <https://XXXXXX.app.netsuite.com/app/common/custom/itemoptions.csv?bundlefilter=BLANK&sortcol=rank&sortdir=ASC&csv=Export&OfficeXML=F&pdf=&size=1000&showall=T>
    I’ve tried calling both using https.get and proper oauth headers but it just takes me to a login page. I know it’s something to do with that URL and that otherwise my headers are ok, as I’ve tested by calling the URL of an internal-only Suitelet and THAT works just fine.
  • s

    Summer Sun

    08/26/2025, 3:53 AM
    Hello all, we have a customer would like to have a report that shows assemblies' component costs, labor costs, and if there are subassemblies, breaks subassemblies' total costs to their own material and labor costs. Seems like to be able to get to this level of detail, may require script. Has anyone build something similar to this before? Any guidance, examples would be appreciated. Thanks!
  • a

    alien4u

    08/26/2025, 3:07 PM
    @Summer Sun There is a NetSuite bundle that shows this but the implementation and performance is questionable to say at least. This is not going to be an straight forward script, it will require delicate craft. It could be something like this: Map Reduce Script: • getInputData: ◦ Search all items that are member of (an assembly), calculate the cost. ◦ Continue to do this recursively in reverse order. ◦ This give you the cost per Assembly. ◦ Store the cost per assembly. • Map: ◦ Update any assembly cost you previously calculated. This is simply an idea... but something along those lines should work.
  • v

    Vaibhav Patil

    08/26/2025, 4:40 PM
    Hi Everyone, I am facing a performance issue with a Suitelet where I am loading three saved searches, combining the results, and displaying them on the Suitelet page; the combined results are more than 50,000 records, and although I am using pagination with 1,000 records per page, the Suitelet URL takes too long to load initially and navigating between pages is also very slow, so I would like to know what is the best way in NetSuite to efficiently handle such a large volume of records with minimum load time, and later I also need to add an “Export to Excel” functionality for these results.
    g
    a
    +3
    • 6
    • 8
  • a

    Aaron McCausland

    08/27/2025, 10:28 PM
    Are N/query Query objects not okay to return from a MapReduce : getInputData function? The documentation says it expects this as one of the returned types. But when I try to do it, it fails in the MapReduce status details but does not catch any errors from the following code:
    Copy code
    function getTransactions(){
    		try{
    			const curScript = runtime.getCurrentScript();
    			const datasetId = curScript.getParameter({name: "custscript_fbsg_distautobill_dataset"});
    			
    			const myQuery = query.load({id: datasetId});
    			const condYesterday = myQuery.createCondition({fieldId: "createddate", operator: query.Operator.ON, values: "today"});//TODO: Change to yesterday once done testing.
    			myQuery.condition = myQuery.and(myQuery.condition, condYesterday);
    			
    			log.debug("getTransactions condition", myQuery.condition);
    			return myQuery;
    		}catch(err){
    			log.debug("getTransactions error", err);
    		}
    	}
    What's going on?
    d
    s
    • 3
    • 4
  • k

    Kristopher Wood

    08/28/2025, 7:28 PM
    Hi everyone, I have a hypothetical question for you: You and your brother are creating a startup using NetSuite to power a customer portal for an under-served industry. Your brother is fronting 100% of the financial costs and you are fronting 100% of the software development labor. What would you expect to get out of the arrangement?
    t
    s
    n
    • 4
    • 9
  • j

    JC

    08/28/2025, 8:57 PM
    Anyone knows of a way to close work orders in bulk via script? not a checkbox at the line level or a dropdown on the WO. It's a button...
    k
    • 2
    • 3
  • r

    reza.seedin

    08/29/2025, 5:21 AM
    Hi Everyone, I’m using the NetSuite customer portal to give customers access to view quotes. I created a custom field that I’d like to display when the customer views the quote. Here’s what I’ve tried so far: • Created a custom role and an external quote form. • Granted the role access to view the field. • Attempted to specify the custom form directly in the URL. The field still isn’t showing up on the customer-facing quote. Has anyone run into this before or found a workaround?
    c
    m
    • 3
    • 3
  • m

    Mia Li

    08/29/2025, 9:15 AM
    Hi everyone, I’m trying to trigger a workflow when a Payment Event record is created. However, in the workflow setup, I couldn’t find Payment Event in the record type dropdown. Has anyone implemented this before? Is it possible, or do I need to use a script instead? Thanks in advance!
    m
    • 2
    • 1
  • b

    Bryan Miller

    08/29/2025, 4:07 PM
    Hi Everyone, I have a client script deployed on Requisitions that doesn't even load into the browser console in the employee center role. There are other deployed clients that load (i.e. Drag and drop) while in employee center. The client loads into the browser in other non-employee center roles as well. It is deployed to all internal roles. Anything that I am missing? Happy to share the script as well - just seems odd that it wouldn't even load into the browser and give errors.
    m
    • 2
    • 2
  • j

    jen

    08/29/2025, 4:29 PM
    Does anyone know if there is a way to call an internal URL of a page in NS from a script. My use case is that I want to “scrape” this page https://XXXXX.app.netsuite.com/app/common/custom/itemoptions.nl?whence= or ideally the actual CSV download link from that page https://XXXXXX.app.netsuite.com/app/common/custom/itemoptions.csv?bundlefilter=BLANK&amp;sortcol=rank&amp;sortdir=ASC&amp;csv=Export&amp;OfficeXML=F&amp;pdf=&amp;size=1000&amp;showall=T I’ve tried calling both using https.get and proper oauth headers but it just takes me to a login page. I know it’s something to do with that URL and that otherwise my headers are ok, as I’ve tested by calling the URL of an internal-only Suitelet and THAT works just fine.
    a
    • 2
    • 7
  • k

    Kristopher Wood

    08/29/2025, 5:29 PM
    Question: Would you use a NetSuite SDF app marketplace to buy or sell apps the same way you would your mobile OS app store? You could one click install or uninstall apps as needed, search and find apps by type and description, ratings, etc, and payment would be handled in the store so no need to coordinate with individual developers/clients, all vetted, automated, and managed?
    a
    n
    • 3
    • 17
  • a

    ashokkumar9640444

    09/01/2025, 9:17 PM
    Hi #C29HQS63G, Quick Help needed. This is very urgent. I want to stop this script execution immediately. Is there a way to stop the currently running Map/Reduce script, which is running for the 60k search results? Please Helppp!!!!!!!
    a
    c
    • 3
    • 2
  • j

    JR

    09/03/2025, 3:07 PM
    Hi All. In a sales order, I'm trying to add an additional item to the item list when adding a specific item. I have created a validateLine script that gets triggered when an item is entered. It seems to get called correctly. I have logic in place that if the item on the line equals a specific item, it will then call selectNewLine, populate the item i wish to add, then call commitLine. No matter what i do, it seems to only replace the original item with the new one, instead of add both. Does anyone have a working model of how to do this? Any incite would be greatly appreciated. Thx
    Copy code
    /**
         * @NApiVersion 2.x
         * @NScriptType ClientScript
         */
        define(['N/record', 'N/ui/dialog', 'N/log', 'N/error'], function(record, dialog, log, error) {
            
            function validateLine(scriptContext) {
    
                var currentRecord = scriptContext.currentRecord;
                var sublistId = scriptContext.sublistId;
                   
                var myItem = currentRecord.getCurrentSublistValue({
                    sublistId: sublistId,
                    fieldId: 'item'
                });                
                
                if (myItem === '42343') {
    
                    // If validation passes and a new line should be added
                    try {
    
                         // Select a new line in the same sublist
                        currentRecord.selectNewLine({
                            sublistId: sublistId,
                        });
    
                        // Set values for the new line 
                        currentRecord.setCurrentSublistValue({
                            sublistId: sublistId,
                            fieldId: 'item', 
                            value: 52154
                        });
    
                        // ... set other field values as needed
                        currentRecord.setCurrentSublistValue({
                            sublistId: sublistId,
                            fieldId: 'location',
                            value: 14
                        });                
    
                        currentRecord.setCurrentSublistValue({
                            sublistId: sublistId,
                            fieldId: 'quantity',
                            value: 2
                        });                
    
                        // Commit the new line
                        currentRecord.commitLine({
                            sublistId: sublistId,
                        });
    
                    } catch (e) {
    
                        // Handle any errors during line creation
                        log.error({
                            title: 'Error adding new line',
                            details: e.message
                        });
                    }
                }
    
                // Always return true to allow the original line to be committed
                return true;
            }
    
            return {
                validateLine: validateLine
            };
        });
    a
    • 2
    • 13
  • p

    Patrick

    09/03/2025, 4:55 PM
    Is there a way to update the owner of a search via script?
    a
    • 2
    • 3
  • v

    Vamshi Reddy

    09/03/2025, 5:44 PM
    Can someone porivde me sample suitescript to remove a specific item and replace with itemtype itemgroup on the saleorder, I am trying to do it with a userevent script event type edit but getting error and unable to set the itemgroup type item?
    a
    j
    • 3
    • 10
  • p

    Patrick

    09/05/2025, 12:21 PM
    What's the best way to split values when reading a CSV file if there are multiple commas on ex: description this is breaking the column numbers
    e
    s
    m
    • 4
    • 8
  • s

    Sim Greenbaum

    09/08/2025, 8:26 PM
    We had a script that closed the old transfer order. This was old code that doesn't work ,but this does transaction.status = 'B'
    Copy code
    AND transaction.status  in ('TrnfrOrd:B')     vs transaction.status  = 'B'
  • g

    GMR Admin

    09/08/2025, 11:36 PM
    Stupid question time:
    Copy code
    // For each expense line, if cseg_comseg has a value, copy it to custcoll_gnt_comm_rqst
              for (var i = 0; i < context.newRecord.getLineCount({ sublistId: 'expense' }); i++) {
                  var commNo = context.newRecord.getSublistText({ sublistId: 'expense', fieldId: 'cseg_comseg', line: i });
                  if (commNo) {
                      context.newRecord.setSublistText({ sublistId: 'expense', fieldId: 'custcoll_gnt_comm_rqst', text: commNo, line: i });
                  }
              }
    Error: Invalid custcoll_gnt_comm_rqst reference key COM53. We're replacing a custom field with a custom segment, and I've got both lists. using the same values but different IDs, hence the setSublistText. The custom field is filtered, but this IS a valid value. Why is it giving me the error?
    a
    n
    • 3
    • 24
  • s

    Sim Greenbaum

    09/09/2025, 3:10 PM
    How is this affecting everyone this morning https://jdstaerk.substack.com/p/we-just-found-malicious-code-in-the
    😮 1
  • j

    JR

    09/09/2025, 3:12 PM
    sublistChanged question: Is there a way to access the "Main" record fields when in this entry point? The script context returns the current line on the sublist that was changed. Within this script, on a Sales Order, i need to access the customer (entity) and the location. I tried "var mainRecord = scriptContext.currentRecord.CurrentRecord;" , but that returned undefined. Any thoughts? Thx
    n
    • 2
    • 2
  • r

    Ryan Longenecker

    09/09/2025, 9:36 PM
    Hey all, is it possible to get custom buttons (approval) to show in the employee center role or is this restricted?
    m
    • 2
    • 3
  • y

    Yogita Kyatam

    09/10/2025, 6:17 AM
    Hi All, is it possible to print ZPL data to printer in netsuite. if yes then how we can achieve?
    m
    s
    i
    • 4
    • 4
  • t

    tuli

    09/11/2025, 1:42 PM
    What are your approaches to keep the code clean in case of new requirements popping up every now an then. I usually structure my code, make it modular using functions, but still When the Original Requirement + 50th new requirement/change come the code is not as clean as I started with. It’s not hard, but due to so many changes it’s not easy as well to maintain the same quality for every new changes.
    s
    m
    • 3
    • 3
  • c

    Cory Weiner

    09/11/2025, 3:16 PM
    Hoping somone can help me out here. I'm trying to take a full backup of our Netsuite file cabinet to Amazon S3 bucket. My plan was upload the files using signed URLs, however I'm running into issues with binary files, for example images, PDFs, etc. AWS expects the format as binary, not a base64 encoded string that file.getContents() returns. Does anyone have advice on converting the bas64 encoded string to a binary format that S3 Will accept?
    a
    • 2
    • 2
  • j

    jen

    09/11/2025, 11:16 PM
    Does anyone know how to schedule a task to run after a delay, for example after 5 minutes? The reason is we have a N/task call to Scheduled Script that creates a sales order and then emails a PDF of that transaction. However, after the sales order is saved, we have a separate process that kicks off generation of a PDF that is included in the Advanced PDF/HTML template. That other PDF takes a couple minutes to be created, so if we try to email the transaction before that, it will fail as the template won’t be able to find the file to include.
    a
    • 2
    • 1