What Does a CRM Do? An Effective Guide to Enhancing Customer Experience

According to WebFX, 87% of businesses use cloud-based CRM platforms, and 73% of customers express that their experience is a vital factor in purchasing decisions. A positive customer experience leads to repeat business, positive referrals, and an increased lifetime value. These experiences also influence the perception of an organization and can have long-term effects on its success. Investing in a solid Customer Relationship Management (CRM) system can help make or break an organization’s customer experience, thereby affecting revenue and profits.


A good CRM is a powerful tool used to engage customers, track and analyze their interactions with your organization, automate campaigns, manage your sales leads, and boost relationships. When implemented correctly, an effective CRM will improve your sales and retain customers by enhancing their experience with your organization.


Now that we are fully aware of how powerful a CRM is, let’s examine and answer some common questions circulating the customer experience and what a CRM can do to help.


CRM for Customer Data Management

 

Customer data management is the process of collecting, managing, and analyzing customer data. With complete and consistent data within a cloud-based CRM, organizations can learn more about their individual customers and can better provide relevant information that leads to customer retention. “Given that a CRM [such as Salesforce] is cloud-based, it allows users to access that data from anywhere, even on the go on their phone,” says Max Holton, Salesforce Solutions Architect at Caravel. He adds, “It’s all being stored and updated in real-time. So, wherever you are, you always have the most updated information on your customer.”


Customer data can include demographic information, work histories, email addresses, names, phone numbers, and more. The more organizations learn about the customer, the more thorough the data is and the better they can target that customer. This personalization strategy is what customers have come to expect in their purchasing journey. Personalizing communication can lead to an increase in conversion rate and business growth; it can improve analytics and the accuracy of forecasting and can, of course, enhance the customer experience. Holton also iterates, “CRM can be structured to collect data points that are not only important to your customer, but important to your business. You can create fields to collect important customer data or collect specific operational data points to report on Key Performance Indicators [KPIs].” This feature allows users to better extract information from the customer that becomes useful to them later in the purchase process and enables them to sell more efficiently.


CRM data management

 

CRM and Automated Processes

An effective CRM can automate certain processes for marketing, sales, and customer service efforts that can catapult engagement and communication. This smart function eliminates repetitive processes like manual data entry, saving time so they can focus on activities of higher value such as building relationships, generating and nurturing leads, and converting contacts into customers. These automated processes allow for more attentive customer service and support, allows the team to quickly respond to requests, and can help organizations communicate across multiple channels. This consistent and relevant communication leads to customer retention and a better customer experience.

“Automated processes enable faster time-to-value for the customer and for the business. The faster the business can service the customer, the greater the customer satisfaction. By eliminating manual processes, you’re minimizing human error, you’re expediting process, and removing bottlenecks so the whole process is more fluid, data is more accurate, and you’re getting the customer in the door, quoted, and delivering your product faster and more efficiently,” explains Holton.


CRM automation can also provide users with valuable insights that helps them better understand customer behavior, preferences, and trends. This enables more targeted and personalized campaigns, which result in a much-improved customer engagement rate and conversion rate. Automation in a CRM also helps to boost relationships with customers by tracking interactions, thereby enhancing the experience and empowering users to be more efficient, effective, and customer-centric in their efforts.


What Does a CRM do for Customer Segmentation?

A powerful CRM will allow its users to segment customers based on specific data points and provide more relevant messaging to those with diverse interests and needs. This will, in turn, improve sales and revenue, customer satisfaction, and the overall experience they have with your organization.


Targeting potential customers based on their preferences and behaviors is impactful. Segmenting lists augments the ability to create a more personalized campaign and creates a more effective way to track the effectiveness of a campaign or even a specific message. The organization can then re-focus its efforts based on results from testing these customer segments and establishing better and more meaningful relationships. “Companies only have a certain amount of salespeople or account managers, and with that, only a certain amount of bandwidth and human hours. By segmenting your customer, you can better allocate your internal resources and maximize that value. Avoid wasting internal resources on segments that are not generating value,” says Holton.


CRM customer segmentation

 

The Power of Customer Feedback Through a CRM

One of the most valuable tools an organization uses to improve and enhance processes is customer feedback. An effective CRM will help collect and analyze that feedback from numerous channels including surveys, reviews, and social media and provide insights into their preferences and needs. It can help identify trends and patterns and allow users to make more data-driven business decisions, improve products and services, and enhance the overall customer experience. Through dashboards and reports, organizations can better visualize the customer profile, and improve communication, satisfaction, and loyalty.

How a CRM Empowers Customer Service

What does a CRM do for customer service? A CRM offers immediate access to any and every interaction a customer has with a company. This includes any historical information, past and present purchases, as well as any communications. This valuable information allows for better customer service, as users can instantly retrieve what they need to help. Users will immediately know who they are communicating with, as the CRM can provide a complete view of the customer. This allows for a faster response time and results in better customer satisfaction.


The companies that we see that have a full front-to-end CRM application that do not have their business process and data spread out across multiple platforms – which leads to unclean, inaccurate, and duplicated data – are the most successful as it pertains to customer service. Salesforce, for instance, allows the user to have all data, sales, and customer experience efforts in one place in the cloud. This allows for one customer record being updated in real-time so when you do get to the point where you need to service that customer with a case, you have all that data in one place at your fingertips that is reportable and allows you to better service the customer,” explains Holton.


CRM customer service

 

How Does AI in CRM Help Boost the Customer Experience?

A strong CRM will adapt conversational AI into its platform to help users better understand company and customer data. AI empowers CRM users to quickly update information about customers from anywhere including their mobile devices, helps to surface answers about customers more swiftly, and allows cross-functional teams to collaborate better. Salesforce AI, for instance, allows companies to tailor promotions based on customer segments, which is powered by the company’s data. The AI is constantly learning based on the user’s intent, which helps to connect with customers faster, more efficiently, and more precisely. AI can help boost productivity and personalization, effectively making the customer experience more impactful.


When organizations implement a robust CRM into their daily activities, they’re committing to the customer. They’re collecting and managing customer data while automating their processes and personalizing communications. Effectively, these organizations are saving time and money while offering a better customer experience because they’re employing the right technology that will prove its worth as the brand grows and the customer remains loyal.


Caravel views CRM systems such as Salesforce as an enabler of better business and customer care. We advise our clients through a proven, successful implementation strategy that allows for flexibility and change. Through proper support and optimization, we help clients refine their Salesforce configuration and match it to their continuously evolving business model. Want to learn more? Contact us below.

The NetSuite 2023.2 Quick Guide

Author: Tom Pearce Sales Marketing Coordinator


NetSuite is releasing their newest update called NetSuite 2023.2 for the beginning of Autumn, much like the 2023.1 update they released at the beginning of the year, NetSuite 2023.2 is full of new ways to improve your business processes and improve user experience and adoption. At Caravel, we wanted to provide a targeted summary on what new features NetSuite is bringing to its users, if you want to learn more, we highly encourage you to look at the full release notes available to you in your NetSuite portal home screen. If this makes you eager to start with NetSuite 2023.2, please reach out to your Project Manager.

Striving for Warehouse and Manufacturing Efficiency:

NetSuite understands that the strain on supply, and the effect it has on fulfilling customer demand has not wavered at all. With NetSuite 2023.2 release, NetSuite is making their user’s warehouse and manufacturing management even more accessible. NetSuite has updated its mobile application offerings, improving warehouse speed and accuracy with Smart Count barcode scanning, both of which can save you on shipping and more!


The NetSuite 2023.2 release has provided users of the Supply Chain Management (SCM) app with huge updates to its user experience. They have made the navigation smoother and focused on making it user-friendly by simplifying roll changes and allowing user preferences. The update also streamlines the NetSuite Warehouse Management App. Allowing supervisors the expedience in reassigning employees, custom picking orders, and more to help reduce friction in your warehouse on both the supervisor and picker levels.


To help users save money with shipping NetSuite is making it possible to use NetSuite Ship Central to shop for the best rates, create return labels, calculate cost based on weight, and more. Just like the SCM app, user experience is improving for shipping as well allowing for user preferences, workflows, and more automation for customers using Shopify and Amazon. The NetSuite Connector is bringing users the capability to eliminate manual reconciliation for Shopify and Amazon. Users can also sync shipping services that are purchased from Amazon to NetSuite thus simplifying order fulfillment and reducing costs.


Learn more about how the 2023.2 update can improve your warehouse and manufacturing here.

Improving Your Employee Experience and Confidence:

With a tool like NetSuite, it is easy to get lost in all its capabilities and functions. Having to search for solutions, look at notes, or any other way users might help themselves navigate NetSuite slows down the processes and causes interruptions throughout the day. NetSuite 2023.2 aims to eliminate the pause in work to look up a “how to” guide and have implemented NetSuite Guided Learning. The NetSuite Guided Learning experience was built with a focus on streamlining user experience and eLearning. NetSuite Guided Learning now offers users visual walk-throughs, step-by-step guidance, progress tracking and self-managed learning tailored to the users’ roles.

Learn more from NetSuite here.



There’s no denying the importance of data in today’s business environment. Shifting costs, volatile economic conditions, and intense competition necessitate data-driven insights. Yet, many companies encounter roadblocks when it comes to making data usable.


Operational and Financial Focus:

Improving efficiency to reduce business spending while seeing an increase in productivity and growth is one common goal for businesses. NetSuite understands this and NetSuite 2023.2 is providing you with the tools to achieve this. Some of what NetSuite 2023.2 is doing to reach that goal is increasing its use of automation, reducing tedious tasks, and making bill paying simpler.


NetSuite states that the automation in their NetSuite Account Reconciliation tool “automates the entire reconciliation process for the general ledger including intercompany transactions, accounts receivable (AR) and payable (AP), bank and credit card transactions, accruals and fixed assets accounts, and other balance sheet accounts”. This will completely remove the need to pull and makes sense of data from multiple sources manually. With machine learning and NetSuite’s auto-match engine users will be able to have millions of transactions matched in minutes and accounting teams will only need to focus on the exceptions, high-risk, and strategic tasks.

NetSuite is also making updates to the NetSuite Bill Capture, Vendor Invoice Distribution SuiteApp, and NetSuite AP Automation to reduce the workload for accounts payable teams. Users will be able to lean on the machine learning in the NetSuite Bill Capture feature to organize expenses based on past bills and will provide recommended subsidiaries. Teams will be able to expedite the bill-paying process by allowing for batched approvals with the Payment Approval Routing now offered in the NetSuite AP Automation. Also, if you have teams that need to share costs now the Vendor Invoice Distribution SuiteApp allows them to simply distribute costs by percentages or amounts and once the distribution is completed, the SuiteApp automatically creates the needed entries.


There is much more to see about this update here.


This is just the surface of what NetSuite is offering in the NetSuite 2023.2 update. To learn more, you can look here or on your NetSuite environment home page. We at Caravel are excited for these updates to be implemented. We are also always ready to talk you through what and how integrating these can improve your business.


The NetSuite 2023.1 Quick Guide

Author: Tom Pearce Sales Marketing Coordinator

We are past the start of the new year, which means we are finding our footing and life is moving back to normal. This also means there are some very exciting new opportunities on the horizon for us to present to you, and NetSuite has already delivered on one of them.


NetSuite is kicking off the new year by showing us several updates to improve business processes already. They have brought out the sneak peak of NetSuite 2023.1, and we at Caravel are excited to break down the highlights and explain what you can expect us to be implementing this year. If you want to learn more about any of the following, feel free to check the home screen of your NetSuite portal. Learn how to start with the 2023.1 update by reaching out to your Project Manager.


With improved CRM, CPQ, inventory management, data-based recommendations, and more, this first update of 2023 is packed with new tools for your business.

Improving Personnel Management:

NetSuite’s 2023.1 brings with it several tools that will improve tracking productivity while alleviating some of the stress of adjusting wages. Your team can now automate wage calculations with a NetSuite Payroll integration, allowing you to easily capture schedules and adjust wages based on a more accurate review of hours worked.


Utilizing this feature will also open more opportunities to improve customer satisfaction. You will be able to track workforce insights—such as sales data—to learn and follow trends to guarantee you have the scheduled staff to ensure customer satisfaction.


Another interesting element is a more complex employee time tracker. NetSuite explains that this will be beneficial for industries that need to track employee time more specifically. For example, it can track how much time an employee in an office setting puts toward projects and clients, or how much time an employee in a driving industry is traveling before their mandatory rest period. Employees will be able to easily adjust their status and have it accurately tracked to make billing easier, as well as maintaining safety regulations for truck drivers. NetSuite has an article that breaks down more of the impressive opportunities with this tool here.


Simplified Financials:

In the NetSuite 2023.1 update, vendor billing will be simplified by applying automation. NetSuite AP Automation is a new feature that allows you to upload your vendor bills with an email to NetSuite to be processed automatically. Then, a digital version is created and all the important details (vendor name, PO number, items ordered, quantity, pricing, etc.) are populated and matched to the correct purchase order.


If you offer subscription-based services to your customers, this release permits you to easily adjust and plan for percentage changes to apply to any of your subscribers. Learn more about these and some other interesting new features for rebates, nonprofits, and more here.

Warehouse and Shipping Efficiency:

The new NetSuite Ship Central is going to save your warehouse employees time and money. This update allows your warehouses to track if there are multiple orders going to one customer, consolidate, and efficiently ship the orders, thus reducing the number of shipments to a single location. It can even help you improve your order picking process.


With the NetSuite Warehouse Management System update, you can even section your warehouse into zones and allow multiple employees to pick order items based on zones, then pool items together for packing. Teams will be able to easily mark orders as partial or complete while also tracking empty bins or damaged goods in their sections to expedite restocking. There are some other very helpful updates for warehouse teams like improved smart counts and reports that you can read about here.


Improving Your Customers Experiences on Multiple Levels:

Utilizing the NetSuite 2023.1 update aims to not only improve your internal business processes but also to assure you are providing your customers and end users with the best service possible. With improved CRM, CPQ, inventory management, data-based recommendations, and more, this first update of 2023 is packed with new tools for your business. We can’t wait to help you learn and implement these features to help expand and optimize your business. To start, reach out to your project manager. If you haven’t started with Caravel yet and want to learn more about how we can help integrate these new features to serve your business, we are always ready to talk.


The Dos and Don’ts of Performance and Optimization Inside NetSuite

Author: Luke Pirtle, Director of IP Development

Overview

Performance inside NetSuite is usually done incorrectly due to misunderstandings on where to optimize, what to optimize, how to optimize it, and what NOT to optimize.

There are numerous statements and definitions of good code all over the internet written by various people with varying credentials. Most definitions bear a resemblance to the following.

The code must be:
• Readable
• Scalable
• Testable
• Fail Gracefully
• Easily Extendable
• Reusable

The biggest takeaway from this list is that performance is toward the end of the list. A few will even mention avoiding premature optimization, stating it’s harmful. It cannot be overstated that quality code is not the fastest-running code; rather, quality code follows the tenets above. If a solution is 10x faster but has intermittent errors and doesn’t indicate when it fails, you’ll end up with a client who is upset because their integration has been turned off for a month without any notice.

Performance should be considered but only after the other tenets are addressed. Typically, it’s also an afterthought and should only be done if requested. Rarely is there an issue with a solution being “too slow,” so there is no reason to risk the possibility of a bug or client escalation due to an unsolicited update. Before optimizing, always write good quality code.

Optimization: Breakout and Isolate

What needs to be optimized is commonly misunderstood. The first step in optimization is breakout and benchmarking to identify what needs to be prioritized. Developers typically want to create cool, clever solutions and use this as an excuse to theorize what needs an upgrade instead of investigating further. It can lead to severely overcomplicated data structures and algorithms because it’s fun, versus doing the legwork that will produce tangible results.

For example, I once had a solution that took mere seconds to commit a line on a sales order but was a painful UX experience. I optimized it with bulk searches and async calls and made it as streamlined as possible. Then, I discovered that my solution had never taken more than 0.1 – 0.2 seconds to run on average. The slowdown was due to the absurd number (over 250) of custom fields that were on the transaction line with over 25% being list / record fields. The system needed to work with those extra columns and references and that was taking 95% of the time needed to commit.

I had only shaved off tenths of a second at most and spent a week or two in the weeds. Testing the same pre-optimized code base on a standard form without these fields resulted in instantaneous performance. Without my investigation, the solution could never have taken less than the 2 seconds I started with. I was fighting an unwinnable battle. I only did this analysis at the end when I ran out of ideas on how to increase performance further. You need to start with the low hanging fruit and work your way up the tree. There are times you’ll need to climb all the way up to the top, but typically you can make quick and easy changes to optimize solutions to an acceptable range.

What to Optimize

HTTPS Requests and Network Calls

Computers are fast and have been for a while. For a frame of reference—CPUs are rated in GHz which is measured as instructions/seconds. This means a 1 gigahertz (GHz) computer completes a billion clock cycles per second. However, HTTPS have an actual physical distance to travel and when you make a request it drastically slows things down.

Numerous strategies and caches are used by ISPs and data engineers to mitigate the number of calls and distance required for calls, but there is always a physical distance slowdown. HTTPS calls usually take 1.5 seconds on average and lines of code execute in less than a millisecond. HTTPS calls should be consolidated and minimized. It is far “cheaper” and more efficient to do client-side computations rather than multiple HTTPS calls. Bulk operations should be performed as well. For a simple analogue, consider going to the grocery store several times throughout the day for each ingredient versus going with a list and getting it all at once.

Optimization Tips:
• Try to consolidate multiple calls to external resources.
• Use Async calls, when possible, to unblock the CPU while these are working.
• Avoid unnecessary calls by removing any relics from your code.
• Use caching methodology and keep local copies of values and files when possible and only look them up when necessary.

API Calls

Most API calls in NetSuite initiate a request to the server, perform a database operation, or utilize some internal resource on their network. These requests are optimized and travel shorter distances but have the same detriments as the HTTPS calls mentioned above. Every search, query, record load, file saved, etc. makes a call to a server or database and should be minimized or consolidated in bulk.


Optimization Tips:
• Don’t use database operations unless you need them. Record.load should only be used if you are going to write to the record or get something only available by loading a record. Use the search module instead.
• Prioritize bulk searches. If you have to look up a value for each line on a transaction, identify all elements up front and run a search to get them all at once.
• Remove debugging logs from scripts once you have a working solution. Rather than removing all logs, keep the logs informative and useful by removing the “Got here” and spot check variable logs.
• Modify log levels when not debugging. Turn a script from “debug” to “audit” or “error” to prevent log noise and increase performance.

CSV

CSV import is a robust, simple, and very performant operation for updating and creating records in NetSuite. You can multithread imports, have them run on multiple queues, and disable scripts and workflows if you don’t need them. They can be manually used by non-functional resources but also triggered from server-side scripts for complex automations. You don’t have as much control over the logic as you do with a script, but it’s usually not required for bulk operations or can be done beforehand.

Optimization Tips:

  • SuiteCloud + Licenses are key. If you have 0 licenses, you have 1 thread and 1 queue for the entire account. If you have 1 license, you have 2 threads and 5 queues which is roughly 10x the speed. SuiteCloud + licenses can be prohibitively costly, so design after you take this into consideration.
  • Use CSVs whenever possible. They are easy to setup, faster to execute than suite script, and provide built-in error handling. Developers tend to always favor scripts but the performance and simplicity of CSVs can’t be denied. Use the best tool for the job.

Map / Reduce for Multithreading

The Map/Reduce design pattern is powerful. However, developers usually just need a multithreading option and skip the map or reduce stage. Typically, the biggest slowdown / process intensive tasks are running a search, saving records, and network requests. Multithreading these elements scales down the highest latency code in your script, saving you precious time.


Optimization Tips:

• SuiteCloud + Licenses are key. If you have 0 licenses, you have 2 SuiteCloud Processors for the entire account. If you have 1 license, you have 5 threads with 5 time the speed. SuiteCloud + licenses can be prohibitively costly so design after you take this into consideration.

• Prefetch static values (meta data for queues)

• Break out searches if they are large and complicated. If possible, chunk out search pages to the map stage and run them there to multithread your search. This also prevents timeouts for large or complex searches.

  • Break out API calls into separate threads to multithread the most impacting part of development.

What NOT to Optimize

Anything at the JavaScript level, you do not need to optimize. You should not be trying to augment NetSuite code like Google or Apple. I can imagine the developers who use binary trees and layers of typescript screaming right now, but if you use binary trees in JavaScript and with NetSuite you are doing it wrong. There is no room for preference or subjectivity. This is the truth specifically for the NetSuite ecosystem due to its size and typical use cases. NetSuite’s core demographic is small to medium sized businesses and an enterprise level client here and there. This business model and demographic does NOT benefit from micro optimizations that can save milliseconds over millions of computations by leveraging advanced data structures and algorithms. If you are struggling that much you are on the wrong system or need to simplify your process.

  • Google developers deal with billions of search results, while NetSuite searches are capped at 10,000 data results.
  • Google deals with C++, Java, and Python. NetSuite uses a Java Virtual Machine to run JavaScript on an ECMA standard.
  • Micro optimizations are usually dependent on low-level understanding of processors, registries, and datatypes. JavaScript can’t do any of that because it only has one datatype for numbers and its “float.” JavaScript also can’t add correctly, which is why you will see gems like the screenshot below:

Typically, the overhead from advanced data structures and algorithms isn’t even realized until you get to large datasets that exceed the usual 10,000 elements. In JavaScript, sometimes this never happens. It’s actually harmful in the NetSuite ecosystem by adding extra overhead, test cases, and complexity, and it provides no benefit. Take a look at the example below using a benchmarking tool I created:

I wanted to know which array operation was faster in NetSuite. I had a Suitelet run both examples 100,000 times each and received the following results: 255ms vs 117ms.

I was able to run an entire benchmark of 100,000 iterations for both unit tests in significantly less time than a single average HTTPS request (1500ms).

Now, watch when I add a single log into this operation:

Twelve whole seconds versus the 0.152 seconds because I added a single log to each iteration.

Javascript code is fast, network request and API calls are not—use this information as best you can. Don’t overcomplicate your JavaScript; if you want to optimize performance, you can have much more impact by removing unnecessary logs first.

The strategy should not be how to implement a hashmap or binary search into your code to make things lightning fast, it should be how to implement these things to make better quality code. These features aren’t taboo, but rather their misuse is. I do not have a pet peeve against complex code—I write a lot of crazy Map / Reduce scripts and have even used classes on more than one occasion. The difference is I used a class because the data structures were polymorphic and benefited from the approach. Code can be basic and complicated as long as the complexity is not driven from a misguided attempt at optimization.

Advanced Archive File Manipulation In SuiteScript

Author: Luke Pirtle, Director of IP Development

Overview:

This guide is technical in nature and details how to successfully unzip any archive file or folder inside of NetSuite and store the results in the file cabinet without the use of a middleware. While the compress module exists it is not sufficient for heavy lifting and this solution can resolve many use cases not supported by the official module.

Background:

When it comes to unzipping files most languages such as C++, Python, .NET, it’s mostly an afterthought. Even JavaScript can unzip files as numerous libraries exist but it’s not always straight forward to use most Node.js libraries inside the NetSuite ecosystem. The challenge is getting a library that works in the SuiteScript AMD module loader with minimal polyfill functions that doesn’t use ECMA script exceeding your current SuiteScript standard.

Due to these limitations the best solution is to add a middleware or redesign things completely. However, I recently ran into an unavoidable use case and neither was a satisfactory path. After extensive research and testing I’ve found a lightweight no hassle solution to work with archived files / folders. At some point NetSuite might release updates to the compress rendering this unnecessary but until then this should address these issues

Solution:

he solution is simply the impressive JSZip library but getting the library to work in NetSuite is not simple
https://stuk.github.io/jszip/

Version:

This is the key and most important piece. The current version of the JSZip library is 3.X and utilizes some impressive asynchronous functions and patterns for better performance. Despite trying every syntax and asynchronous method this new version is incompatible with the ECMAScript standard and NetSuite configuration in SuiteScript. Every permutation will eventually break right before reading the file contents.

However, the 2.7 version works and doesn’t include the asynchronous components. This stripped down version has all the capabilities without the unnecessary advanced asynchronous features and is fully compatible with the 2.1 SuiteScript ECMA script configuration.

Loading the module in a Suitelet:

NetSuite uses an AMD (Asynchronous Module Definition) loader. This is the biggest hindrance in getting Node.js modules to work. Fortunately, JSZip has a minified singular file that can be dropped into NetSuite. Below I detail how I load the module but I’ve also included the author’s notes on how it’s loaded in the system to give a full picture of what is happening.

Working with 2.7

I have the minified JSZip file in my project library folder and below demonstrate how to load it.

This allows the creation of new JSZip Instances to work with archives. With this configuration, the issue is much more straight forward now as we only have to write code. Sample code is detailed further down and documentation on the older version can be seen in their upgrade guide linked below
https://stuk.github.io/jszip/documentation/upgrade_guide.html

Sample Code

This solution below loads an archive file which is a folder with ~numerous files of differing types and is an excellent example. The code reads the archive file using the N/file module, then it iterates through each file and then creates a corresponding file in the file cabinet.

In my code snippet above you’ll notice the references to base64, this is because NetSuite uses base64 for essentially everything non-plaintext and files are no exception. Fortunately JSZip can handle this. Grab the contents of your archive file via N/file use the “getContents()” method to return the base64 content of the archive file. Drop that into the JSZip initialization (line 64) with the base64 argument set and now you have a valid JSZip Archive instance object loaded via SuiteScript. To create files you’ll simply need to iterate through the files subobject and then run the JSZip “file” method to read the contents. When creating files in NetSuite you’ll need to once again consider base64. Text is needed for text files and Base64 for anything else. To determine what is needed, look at the file extension. Once you have encoded your file simply save it and you now have a file committed to the file cabinet. Below I have a text reference for copying and utilizing in your own solutions.

Plaintext Reference for (Ctrl + C):

let extensionMapping = {
    'XML': file.Type.XMLDOC,
    'html': file.Type.HTMLDOC,
    'PDF': file.Type.PDF,
    'JPG': file.Type.JPGIMAGE,
    'BMP': file.Type.BMPIMAGE,
    'xlsx': file.Type.EXCEL,
    'txt': file.Type.PLAINTEXT,
    'json': file.Type.JSON
};

let plainTextTypes = [
    file.Type.CSV,
    file.Type.XMLDOC,
    file.Type.HTMLDOC,
    file.Type.PLAINTEXT,
    file.Type.JSON
];

let archiveFile = 57163;
let archiveFolder = 56852;
let xactimateTestArchiveTargetFolder = 2510;

let zipFileObj = file.load(archiveFolder);
let bin = zipFileObj.getContents();

var ZipInstance = new JSZip(bin , {base64: true});
for (let fullPathFileName in ZipInstance.files){
    if (fullPathFileName.indexOf('.' !== -1)){
        let fileName = fullPathFileName.split('/').pop();
        let fileExt = fileName.substring(fileName.lastIndexOf('.') + 1).toUpperCase();
        let netsuiteExt = extensionMapping[fileExt];
        log.debug({title:`File to ${ netsuiteExt ? 'Create' : 'Ignore' }`, details:`FileName: ${fullPathFileName}, fileType:${fileExt}, NetSuiteType: ${netsuiteExt}`});
        if (netsuiteExt){
            let data =ZipInstance.file(fullPathFileName).asBinary();
            if (plainTextTypes.includes(netsuiteExt) === false){
                data = JSZip.base64.encode(data);
            }

            let zippedFile = file.create({
                name:fileName,
                folder:xactimateTestArchiveTargetFolder,
                contents:data,
                fileType:netsuiteExt
            });
            zippedFile.save();
        }

    }

}

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Fill out the form to view the webinar and opt-in for future Caravel updates!

Stay In Touch

Register for our newsletter and all other updates that the Caravel team has to share!