SCM Mobile Scripts for Printing

SCM Mobile provides the RESTlet that runs the print action to submit a print request from a NetSuite page. In your client script, you can call this RESTlet through the following details:

SCM Mobile also provides the following sample scripts for invoking the RESTlet, which you can use as reference when you create your own scripts:

Using the Administrator role, you can access and view the sample scripts by going to Customization > Scripting > Scripts.

When you create your client script, make sure that you add the input parameters that you want to pass to the RESTlet. These parameters capture your printing preferences and print template details, as shown in the following table:

Input Parameter Key

Data Type

Sample Value

Required?

Description

isDirectPrinting

Boolean

true

Yes

Set this parameter to true to indicate that you want to invoke a print action directly through the NetSuite UI and not from a mobile app.

template

String

PrintTemplate1

Yes

Name of the print template in XML format or the advanced PDF template.

To view the sample print templates used in Mobile Printing, see SCM Mobile Printing.

noOfCopies

Numeric

1

Yes

Default number of copies that you want to print.

printer

String

Printer1

Yes

Name of the default printer.

To view the list of your available printers, see Setting Up Your Printers.

sourceId

String

customrecord_print_source_rec

Yes

The ID of the NetSuite record or saved search that contains the data you use in your print template.

For more information about print templates, see Creating Custom Print Templates and Files.

sourceRowId

Numeric

1

Yes, if your source is a record

The internal ID of the specific row from the source record that you specify in the sourceId parameter.

For example, enter 1 for the row’s internal ID to print the data from the first row of the record.

searchFilters

Array of search filter objects

[{

name: 'internalid',

operator : search.Operator.IS,

values : '1'

}]

Yes, if your source is a saved search

The list of search filters that you want to apply to the saved search. See search.createFilter(options).

resultsNameInTemplate

String

record

No

The name of the object that stores the record’s data or saved search results. Make sure that you provide the name used in the associated print template.

If you do not include this parameter, the RESTlet uses the default result value. In this case, the associated print template must use this value to access data from fields.

In the following sample code, you can view examples of input parameter values for a source record:

          // sample post object with a standard NetSuite record ID as sourceId

postObject['params'] = {
   'isDirectPrinting':'true',
   'template':'Template3',
   'noOfCopies':'1',
   'printer':'Microsoft Print to PDF',
   'sourceId':'itemreceipt',
   'sourceRowId':sourceRowID,
   'resultsNameInTemplate':'searchResults'
}); 

        

Related Topics

SCM Mobile Setup
SCM Mobile App Access
SCM Mobile Printing
Adding a Print Button to NetSuite Pages

General Notices