This topic contains 4 replies, has 0 voices, and was last updated by david.lyle 6 years, 6 months ago.
-
AuthorPosts
-
May 2, 2018 at 1:38 pm #17963
david.lyleCode:
Fail to evaluate script: {“type”:”error.SuiteScriptModuleLoaderError”,”name”:”MODULE_DOES_NOT_EXIST”,”message”:”Module does not exist: N/ui/dialog.js”,”stack”:[]}
I am getting this error message when I try to create a script from a script file. Here is my code:Code:
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @NModuleScope SameAccount
*/
define([‘N/record’, ‘N/ui/dialog’],
/**
* @param {record} record
* @param {dialog} dialog
*/
function(record, dialog) {/**
* Function definition to be triggered before record is loaded.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord – New record
* @param {string} scriptContext.type – Trigger type
* @param {Form} scriptContext.form – Current form
* @Since 2015.2
*/
function beforeLoad(scriptContext) {}
/**
* Function definition to be triggered before record is loaded.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord – New record
* @param {Record} scriptContext.oldRecord – Old record
* @param {string} scriptContext.type – Trigger type
* @Since 2015.2
*/
function beforeSubmit(scriptContext) {}
/**
* Function definition to be triggered before record is loaded.
*
* @param {Object} scriptContext
* @param {Record} scriptContext.newRecord – New record
* @param {Record} scriptContext.oldRecord – Old record
* @param {string} scriptContext.type – Trigger type
* @Since 2015.2
*/
function afterSubmit(scriptContext) {
var stMsg = ‘Hello World! Welcome…’;
alert(stMsg);function success(result) { console.log(‘Success with value: ‘ + result) }
function failure(reason) { console.log(‘Failure: ‘ + reason) }
modDialog.alert({
title: ‘Alert’,
message: stMsg
}).then(success).catch(failure);
}return {
beforeLoad: beforeLoad,
beforeSubmit: beforeSubmit,
afterSubmit: afterSubmit
};});
Can anyone help me troubleshoot? I am new to NetSuite and to SuiteScript, I just got a two day training and am trying to reproduce some of the basic exercises that our instructor rushed through. Thank you for any guidance.
This is a cached copy. Click here to see the original post. -
May 2, 2018 at 1:47 pm #17964
MikeBucklaewHi David. Welcome to SuiteScript. Two things jump out at me. The first is that you have a user event script type which is a server side script. ‘N/ui/dialog’ is a client script module. That’s why it’s not available. The next thing is that in your original function definition: function(record, dialog) { you named it “dialog”. That’s fine and I do that all the time. When you went to call the .alert method you used modDialog.alert. modDialog doesn’t exist in your code. dialog.alert
-
May 2, 2018 at 2:09 pm #17965
david.lyle‘N/ui/dialog’ is a client script module. That’s why it’s not available.
My code was auto-generated from Eclipse (Netsuite IDE). These are all the modules that are available through the IDE: N, N/auth, N/config, N/crypto, N/currency, N/email, N/encode, N/error, N/file, N/format, N/http, N/https, N/plugin, N/portlet, N/record, N/redirect, N/render, N/runtime, N/search, N/sso, N/task, N/transaction, N/ui, N/ui/dialog, N/ui/message, N/ui/serverWidget, N/url, N/workflow, N/xml
Is there any documentation online that tells me which modules are available for which script types? The IDE doesn’t seem to restrict the modules based on which Script Type I set. Thank you
-
May 2, 2018 at 3:06 pm #17966
MikeBucklaewYes. You’ll want to download the SuiteScript 2.0 API pdf. You can get that from the online help under “User Guides” in the section called “SuiteCloud Platform Guides”. The info is also in SuiteAnswers but I like to keep the pdf open myself. You’ll see a section called “Supported Script Types” like this:
-
May 3, 2018 at 6:53 am #17967
david.lyleYou have been very helpful, thank you!
MikeBucklaew replied on 05/03/2018, 07:14 AM: You’re welcome and good luck
-
AuthorPosts
You must be logged in to reply to this topic.