Email Capture Plug-ins as XML Definitions

You can create or import Email Capture plug-in implementations using SuiteCloud Development Framework (SDF). You can create or import Email Capture plug-in implementations in a SuiteCloud project to customize how NetSuite handles email logic. Use the Email Capture plug-in to define NetSuite behavior based on the properties and contents of an email message. When NetSuite receives an email sent to an email address associated with an implementation of the plug-in, NetSuite executes the business logic defined in the implementation. For example, you can use SuiteScript and an implementation of the Email Capture plug-in to process invoices, automate task creation and assignment, or automate escalations through email.

For information about how Email Capture plug-ins are used, see Email Capture Plug-in Overview.

You can create and manage an Email Capture plug-in implementation in a SuiteCloud project and deploy it to a NetSuite account. You can also import an Email Capture plug-in implementation from a NetSuite account into a SuiteCloud project. For more information about importing objects, see Account Component Imports to SuiteCloud Projects.

Customizing an Email Capture plug-in implementation object from your SuiteCloud project is the equivalent of editing or making a new Email Capture plug-in implementation from the NetSuite UI. For example, select Customization > Plug-ins > Plug-in Implementation > New from a NetSuite account.

The following is an image of an Email Capture plug-in implementation record in Edit mode in the NetSuite UI:

Email Capture Plug-In Implementation page

Email Capture plug-in implementations in SDF are represented with the <emailcaptureplugin> object. To define this object, see the following sections:

Create a Plug-in Implementation Script File

You need to have an Email Capture plug-in implementation script either in a NetSuite account, or in the same SuiteCloud project as your XML object. For more information, see Create a Plug-in Implementation Script File and SuiteScript Files in SuiteCloud Projects.

Email Capture Plug-in Implementation Required Fields

The following table contains elements that are required for emailcaptureplugin objects. For a list of all available elements, see the reference documentation for the emailcaptureplugin element in SuiteCloud Development Framework XML Reference.

Element

Type

Description

emailcaptureplugin

single-select list

The element that defines the Email Capture plug-in Implementation object. This element requires a unique scriptid attribute value that defines the object.

Note:

The scriptid attribute is required for the emailcaptureplugin element. The scriptid attribute value must match the filename excluding the file extension.

name

string

A user-friendly name for the Email Capture plug-in implementation. The name is seen by administrators when they activate or deactivate the Email Capture plug-in implementation.

scriptfile

filereference

The script file (.js) that contains the implementation for the Email Capture plug-in.

status

single-select list

The status of the custom plug-in type. Possible values are RELEASED and TESTING. Ensure the value is set to RELEASED prior to bundling the Email Capture plug-in. See Bundle the Plug-in Implementation.

The Libraries (Scripts) Structure

The <emailcaptureplugin> object contains a <libraries> structure to represent the script subrecord.

Element

Type

Description

libraries

structure

This structure contains all the utility script files or supporting library files that your plug-in implementation script file requires to run.

library

structure

This structure represents a single utility script file or supporting library file. You can specify multiple library structures.

scriptfile

filereference

This element takes a file path reference to a utility script file or supporting library file.

For example:

                      <emailcaptureplugin scriptid="customscript_emailcaptureplugin">
      ...
      <libraries>
         <library>
            <scriptfile>[/SuiteScripts/utilityScript.js]</scriptfile>
         </library>
      </libraries>
      ...
</emailcaptureplugin> 

                    

Files in the SuiteBundles and SuiteScripts folders of your File Cabinet can be selected as library files.

Email Capture Plug-in Implementation Object Example

The following is an XML definition example of an Email Capture plug-in implementation object in a SuiteCloud project.

The Email Capture plug-in implementation object, customscript_emailcaptureplugin, creates a new plug-in that is in TESTING status. Debugging messages are logged when the script is run. The owner of the object is notified whenever an error is thrown. The customscript_emailCapturePlugin.js script is called when NetSuite receives an email sent to an email address associated with the Email Capture plug-in implementation.

            <emailcaptureplugin scriptid="customscript_emailCapturePlugin">
    <name>Email Capture plug-in</name>
    <description></description>
    <status>TESTING</status>
    <loglevel>DEBUG</loglevel>
    <isinactive>F</isinactive>
    <notifyadmins>F</notifyadmins>
    <notifyemails></notifyemails>
    <notifyowner>T</notifyowner>
    <notifyuser>F</notifyuser>
    <runasrole></runasrole>
    <scriptfile>[/SuiteScripts/customscript_emailCapturePlugin.js]</scriptfile>
</emailcaptureplugin> 

          

For more information, see emailcaptureplugin element in SuiteCloud Development Framework XML Reference.

Related Topics

General Notices