If you want a hassle-free approach to attaching files programmatically, NetSuite SuiteScript might be for you. With SuiteScript, you can attach single or multiple file types to several kinds of NetSuite records. Attachments can be added directly to a record or through emails.
At this time, attaching emails via SuiteScript is supported via these record types:
Check, Custom Transaction, Expense Report, Inventory Adjustment, Item Fulfillment, Journal Entry, Intercompany Transfer Order, Opportunity, Transfer Order, Sales Order, Customer Payment, Return Authorization, Credit Memo, Cash Refund, Estimate, Invoice, Cash Sale, Purchase Order, Requisition, Customer Payment, Customer Refund, Customer Deposit, Vendor Bill, Vendor Credit, Vendor Return Authorization, Work Order, Work Order Issue, Work Order Close and Work Order Completion.
Customer, Contact, Employee, Partner, Vendor, Project and Group.
Task, Event, Phone Call and Project Task.
Below, you will see script samples for several scenarios. The samples are also available in SuiteScript 2.0 syntax.
In this example, you will notice that the attachfile is called once in the script. Note that for attaching files to record types, we are using a function called attachfile. The attachfile calls the NetSuite API record.attach.
Since the record.attach does not support having an array of files, the only difference here is calling this API multiple times while supplying a different file ID.
Attaching files to an email is done by calling file.load and supplying the result to the email.send API.
If you want to attach multiple files, all you have to do is fill the array on the attachments parameter and load the files separately.
With ServiceRocket, you’ll get certainty, expertise and success built into your NetSuite implementation, configuration and custom development. When you work with us, you get access to NetSuite-trained Certified Developers with over 400+ NetSuite scripts and 50+ Suitelet workflows combined. Rest assured that ServiceRocket will help you find success and provide you with the opportunities you need to transform your business.
Do you have NetSuite license management, implementation, administration, support or custom development needs? We’ve got your back! Contact our NetSuite Certified Experts today.
Ensure the highest return on your NetSuite investment with our custom development or administrative services.