Giter VIP home page Giter VIP logo

netsuite-custom-print-button's Introduction

Netsuite-Custom-Print-Button

Project Overview

placardbutton

Purpose

This custom print button uses NetSuite's Advanced PDF/HTML Template feature to generate a shipping placard PDF based on data fields. The placard is used to keep track of the recipients of pallets and establishes a reliable organization strategy for production.

Features

  • Custom Print Button
  • PDF Template
  • Production Organization

Prerequisites

  • SuiteScript/JavaScript
    • Modules: N/url, N/currentRecord, N/record, N/render
    • SuiteScript Types: Client Script, User Event Script, Suitelet
    • API Version: 2.x
    • JSDoc Tags
  • Advanced PDF/HTML Templates
    • Languages: HTML, FreeMarker, XML, CSS

Project Setup

Uploading to NetSuite

  • Adding a SuiteScript to the File Cabinet: navigate Customization>Scripting>Scripts>New; next to the "Script File" dropdown, press the plus sign to upload a new SuiteScript file; select the NetSuite folder that you want to store the SuiteScript files in; under "Select File," press the "Choose File" button; select the SuiteScript file that you want to upload and press open; save and press the blue "Create Script Record" button; name the file, input a relevant ID, and save

File Descriptions

placard_button_es.js

  • Programming Languages: JavaScript, SuiteScript 2.0
  • SuiteScript Type: User Event Script, beforeLoad
  • Description: creates the custom print placard button for all Item Fulfillment records
  • Catering the Code to Your NetSuite:
    • Applying to Different Record Type: change the JSDoc tag from "itemfulfillment" to the relevant record type
    • Changing the Button Label: find the function "context.form.addButton" and change the parameter "label" to the new label, keeping the new name in quotation marks
    • Calling a Different Client Script: find the function "context.form.clientScriptModulePath" and specify the path where your client script file is stored
  • Deploying SuiteScript: go to the SuiteScript file; press the "Deploy Script" button; enter a name and relevant ID; change the status to "Testing"; under "Execute As Role," choose "Administrator" so that the code will get full access to NetSuite and will not create any permissions errors; under "Applies To," select the record type that you want the button to appear on (I used Item Fulfillment); once the code has been tested, change the status to "Released" and select who can use the button under the "Audience" subtab (selecting "All Roles" will make all users able to use it)

placard_button_click_cs.js

  • Programming Languages: JavaScript, SuiteScript 2.0
  • SuiteScript Type: Client Script, pageInit and onButtonClick
  • Description: calls the suitelet to render and generate the PDF when the button is pressed
  • Catering the Code to Your NetSuite:
    • Applying to Different Record Type: change the JSDoc tag from "itemfulfillment" to the relevant record type
    • Calling a Different Suitelet: find the line "var suiteletURL = url.resolveScript" and change the scriptId and deploymentId to the information associated with the desired suitelet
  • Deploying SuiteScript: go to the SuiteScript file; press the "Deploy Script" button; enter a name and relevant ID; change the status to "Testing"; under "Applies To," select the record type that you want the button to appear on (I used Item Fulfillment); once the code has been tested, change the status to "Released" and select who can use the button under the "Audience" subtab (selecting "All Roles" will make all users able to use it)

placard_button_suitelet.js

  • Programming Languages: JavaScript, SuiteScript 2.0
  • SuiteScript Type: Suitelet, onRequest
  • Description: generates and renders PDF using current record data fields
  • Catering the Code to Your NetSuite:
    • Applying to Different Record Type: change the JSDoc tag from "itemfulfillment" to the relevant record type; change the saved searches to search under the correct record type; whenever there is a record load instance (record.load), change the record type to the correct one
    • Changing the Saved Search IDs: whenever there is a search load instance (search.load), change the parameter "id" to the correct search ID
    • Calling a Different Suitelet: find the function "redirect.toSuitelet" and change the scriptId and deploymentId to the information associated with the desired suitelet
  • Deploying SuiteScript: go to the SuiteScript file; press the "Deploy Script" button; enter a name and relevant ID; change the status to "Testing"; under "Execute As Role," choose "Administrator" so that the code will get full access to NetSuite and will not create any permissions errors; once the code has been tested, change the status to "Released" and select who can use the button under the "Audience" subtab (selecting "All Roles" will make all users able to use it)

Creating the PDF Template

  • Opening New Template: open Advanced PDF/HTML Templates by navigating Customization>Forms>Advanced PDF/HTML Templates; find a template that can be the foundation to the new template (I used a Packing Slip type) and press "Customize"
  • Customizing With HTML: enable "Source Code" in the top right of the new template; use this HTML code as a base; use FreeMarker to take data from records that were added to the template; use the name that is specified in the "templateName" parameter when the record was added to the template in spec_suitelet_render (ex. renderer.addSearchResults or renderer.addRecord); if data is getting pulled directly from record use the format {templateName.fieldName}; if data is getting pulled from sublist use the format {templateName.sublistName.fieldName}; press save when edits are completed
  • Customizing With Advanced PDF/HTML Template Features: disable "Source Code" in the top right of the new template; use the textbox, table, fields, and other tools to modify the template

References

Images

Helpful Links

Extra Tips

  • Choose to execute as the administrator role when deploying the SuiteScripts to make sure everyone has full permissions
  • Go back to the script deployments to check that their status is "Released" and that their audience includes all roles

netsuite-custom-print-button's People

Contributors

elizabethpursell avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.