Script Deployment

Script deployment records are required to run your script in your NetSuite account.

For help working with this record in the UI, see Script Deployment.

The internal ID for the script deployment record is scriptdeployment.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Important:

The recurrenceminutes and starttime fields are not scriptable.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with records in SuiteScript, see the following help topics:

Supported Script Types

Script records are scriptable in server SuiteScript only.

Supported Functions

The script deployment record is fully scriptable — it can be created, copied, updated, deleted, and searched using SuiteScript.

Usage Notes

You can access script deployment records with all server script types. Script deployment records are not exposed to client scripts.

The following objects are not scriptable on the script deployment record:

The following object is read-only on the script deployment record (editing is not supported):

To access script deployment records within a script, the script owner must belong to a role assigned with SuiteScript permissions.

Important:

Scripts can only access script deployment records when the records are part of the same bundle.

Scripts that are not part of a bundle cannot access script deployment records that are part of a bundle.

You can use script deployment records to set up context filtering. Context filtering lets you specify how and when the associated script runs. For more information, see Execution Contexts and Record Localization Context.

For methods that require the ID parameter, you must use the script deployment record’s internal ID (for example, 88). The script deployment record’s script ID (for example, customdeploy_newsfeed_email) is not supported. You can find a script deployment record’s internal ID at Customization > Scripting > Script Deployments. If you have the Show Internal IDs preference enabled at Home > Set Preferences, internal IDs are listed in the Internal ID column.

The Script Deployments page with the Internal ID column highlighted.

For record and search methods that require the type parameter, use the record.Type.SCRIPT_DEPLOYMENT or search.Type.SCRIPT_DEPLOYMENT value.

Code Samples

The following samples show how to create a script deployment record, how to edit a script deployment record, how to read a script deployment record, how to copy and edit a script deployment record, and how to search a script deployment record.

            // Create a script deployment record 
var rec = record.create ({
    type: record.Type.SCRIPT_DEPLOYMENT,
    defaultValues: {
        script: 2 //scriptId
     }
}); 

          
            // Edit a script deployment record 
var rec = record.load ({
    type: record.Type.SCRIPT_DEPLOYMENT,
    id: 65
});
rec.setValue({
    fieldId: 'allroles',
    value: 'T'
});
rec.save(); 

          
            // Read a script deployment record
var rec = record.load ({
    type: record.Type.SCRIPT_DEPLOYMENT,
    id: 203
});
var recStatus = rec.getValue ({
    fieldId : 'status'
}); 

          
            // Copy and edit a script deployment record
var rec = record.copy ({
    type: record.Type.SCRIPT_DEPLOYMENT,
    id: 41
});
rec.setValue ({
    fieldId: 'isdeployed',
    value: 'F'
});
rec.setValue ({
    fieldId: 'title',
    value: 'Feature 4141 - Suitelet Scratch 4'
});
rec.save(); 

          
            // Search a script deployment record
var searchFilters = search.createFilter ({
    name: 'internalidnumber',
    operator: search.Operator.ANYOF,
    values: '43'
});
var searchColumns = search.createColumn ({
    name: 'title'
});
var mySearch = search.create ({
    type: search.Type.SCRIPT_DEPLOYMENT,
    filters: searchFilters,
    columns: searchColumns
});
var mySearchResults = mySearch.run(); 

          

Related Topics

Script Deployment
Working with the SuiteScript Records Browser
SuiteScript Supported Records
Customization

General Notices