Craig
05/08/2025, 3:26 PMkns25
05/08/2025, 3:53 PMKristine
05/08/2025, 6:00 PMN/task
module, the task.checkStatus()
method only indicates whether the job is *Pending/Completed*—it does not provide detailed results on whether the import itself was successful or if it encountered errors. See screenshot this would appear Completed but actually is a failed import of 0/2 records
Has anyone found a workaround to programatically retrieve detailed import results (success/failure counts, error messages, etc.) outside of manually checking the UI?acuestajohnmark
05/08/2025, 8:29 PM/**
* @NApiVersion 2.x
* @NScriptType customglplugin
*/
define([
'N/record'
],
/**
* @param {record} record
*/
function (
record
) {
function reclassifyInterBranchInvoicesToMainLocation(scriptContext) {
try {
const invoiceRecord = scriptContext['transactionRecord'];
const standardLines = scriptContext['standardLines'];
const customLines = scriptContext['customLines'];
const transactionType = invoiceRecord['type'];
const mainlineLocationId = invoiceRecord.getValue({
fieldId: 'location'
});
const standardLinesCount = standardLines.count;
log.audit({
title: 'Details',
details: {
mainlineLocationId: mainlineLocationId,
standardLinesCount: standardLinesCount
}
});
const standardLinesArr = [];
for (var i = 0; i < standardLinesCount; i++) {
const standardLine = standardLines.getLine({
index: i
});
standardLinesArr.push(standardLine)
}
const manualStandardLineArr = [];
const line1 = standardLines.getLine({
index: 0
});
manualStandardLineArr.push(line1);
const line2 = standardLines.getLine({
index: 1
});
manualStandardLineArr.push(line2);
const line3 = standardLines.getLine({
index: 2
});
manualStandardLineArr.push(line3);
const line4 = standardLines.getLine({
index: 3
});
manualStandardLineArr.push(line4);
const line5 = standardLines.getLine({
index: 4
});
manualStandardLineArr.push(line5);
const line6 = standardLines.getLine({
index: 5
});
manualStandardLineArr.push(line6);
log.audit({
title: 'Standard Lines',
details: standardLinesArr
});
log.audit({
title: 'Manual Standard Lines',
details: manualStandardLineArr
});
if (transactionType === record.Type.INVOICE) {
log.audit({
title: 'TRIGGER INVOICE RECLASS HERE'
});
}
} catch (errorObj) {
log.error({
title: 'Error in reclassifyInterBranchInvoicesToMainLocation',
details: errorObj
});
}
};
return {
customizeGlImpact: reclassifyInterBranchInvoicesToMainLocation
};
});
I'm hoping to actually makes this work on SS2.x, but if there's no way around it, I'll just have to make it using SS1.0
As for the logs, here's what I am getting (tabularized for easier comparison):eblackey
05/08/2025, 9:41 PMfor (var i = 0; i < standardLinesCount; i++) {
standardLinesArr.push(standardLines.getLine({
index: i
}));
}
eblackey
05/08/2025, 9:42 PMashokkumar9640444
05/09/2025, 10:52 AMG
05/09/2025, 3:06 PMSlackbot
05/09/2025, 4:06 PMSitaram upadhya
05/10/2025, 11:12 AM"type":"error.SuiteScriptError","name":"INVALID_FLD_VALUE","message":"You have entered an Invalid Field Value 6 for the following field: taxcode"
Below is the code. Where am I going wrong?
/**
* @NApiVersion 2.1
* @NScriptType Restlet
* @NModuleScope SameAccount
*/
define(['N/record', 'N/format', 'N/error', 'N/log'],
function(record, format, error, log) {
/**
* Function to handle POST request - creates a Credit Memo
* @param {Object} requestBody - The request body from the external system
* @returns {Object} Response object with created Credit Memo ID and other details
*/
function doPost(requestBody) {
try {
log.debug('Request Body', JSON.stringify(requestBody));
// Validate required fields
if (!requestBody.entity) {
throw error.create({
name: 'MISSING_REQ_PARAM',
message: 'Entity (customer) is required'
});
}
// Create Credit Memo record
const creditMemo = record.create({
type: record.Type.CREDIT_MEMO,
isDynamic: true
});
// Set header level fields
creditMemo.setValue({
fieldId: 'entity',
value: requestBody.entity
});
// Set trandate if provided (format: mm/dd/yyyy)
if (requestBody.trandate) {
const parsedDate = format.parse({
value: requestBody.trandate,
type: format.Type.DATE
});
creditMemo.setValue({
fieldId: 'trandate',
value: parsedDate
});
}
// Set tax details override flag
if (requestBody.taxdetailsoveride) {
creditMemo.setValue({
fieldId: 'taxdetailsoverride',
value: requestBody.taxdetailsoveride
});
}
// Add line items
if (requestBody.lines && Array.isArray(requestBody.lines)) {
for (let i = 0; i < requestBody.lines.length; i++) {
const line = requestBody.lines[i];
// Select new line
creditMemo.selectNewLine({
sublistId: 'item'
});
// Set line item
creditMemo.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: line.item
});
// Set amount
if (line.amount) {
creditMemo.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'amount',
value: line.amount
});
}
// Set HSN code if provided
if (line.hsncode) {
creditMemo.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'custcol_in_hsn_code', // Adjust field ID as needed
value: line.hsncode
});
}
// Commit the line - only need to commit once
creditMemo.commitLine({
sublistId: 'item'
});
}
}
// Handle tax details separately after all item lines are added
if (requestBody.taxdetails && Array.isArray(requestBody.taxdetails)) {
for (let j = 0; j < requestBody.taxdetails.length; j++) {
const taxDetail = requestBody.taxdetails[j];
// Select the tax details sublist
creditMemo.selectNewLine({
sublistId: 'taxdetails'
});
// Tax code is required - make sure we have a valid value before proceeding
if (!taxDetail.taxcode) {
throw error.create({
name: 'MISSING_REQ_PARAM',
message: 'Tax code is required for tax details'
});
}
// Set tax code first since it's required
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'taxcode',
value: taxDetail.taxcode
});
// Now set the other tax detail fields
if (taxDetail.linename) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'linename',
value: taxDetail.linename
});
}
if (taxDetail.linenumber) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'linenumber',
value: taxDetail.linenumber
});
}
if (taxDetail.linetype) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'linetype',
value: taxDetail.linetype
});
}
if (taxDetail.netamount) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'netamount',
value: taxDetail.netamount
});
}
if (taxDetail.taxamount) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'taxamount',
value: taxDetail.taxamount
});
}
if (taxDetail.taxbasis) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'taxbasis',
value: taxDetail.taxbasis
});
}
if (taxDetail.taxdetailsreference) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'taxdetailsreference',
value: taxDetail.taxdetailsreference
});
}
if (taxDetail.taxrate) {
// Remove percentage symbol if present and convert to number
let rateValue = taxDetail.taxrate;
if (typeof rateValue === 'string') {
rateValue = rateValue.replace('%', '');
}
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'taxrate',
value: parseFloat(rateValue)
});
}
if (taxDetail.taxtype) {
creditMemo.setCurrentSublistValue({
sublistId: 'taxdetails',
fieldId: 'taxtype',
value: taxDetail.taxtype
});
}
// Commit the tax detail line
creditMemo.commitLine({
sublistId: 'taxdetails'
});
}
}
// Save the credit memo
const creditMemoId = creditMemo.save();
// Return success response
return {
success: true,
creditMemoId: creditMemoId,
message: 'Credit Memo created successfully'
};
} catch (e) {
log.error('Error creating Credit Memo', e);
// Return error response
return {
success: false,
error: {
code: e.name,
message: e.message
}
};
}
}
/**
* Function to handle GET request - retrieves a Credit Memo by ID
* @param {Object} requestParams - Contains the ID of the Credit Memo to retrieve
* @returns {Object} Credit Memo data
*/
function doGet(requestParams) {
try {
// Check if ID is provided
if (!requestParams.id) {
throw error.create({
name: 'MISSING_REQ_PARAM',
message: 'Credit Memo ID is required'
});
}
// Load Credit Memo record
const creditMemo = record.load({
type: record.Type.CREDIT_MEMO,
id: requestParams.id,
isDynamic: false
});
// Get basic info
const creditMemoData = {
id: creditMemo.id,
tranId: creditMemo.getValue({fieldId: 'tranid'}),
entity: creditMemo.getValue({fieldId: 'entity'}),
tranDate: creditMemo.getValue({fieldId: 'trandate'}),
total: creditMemo.getValue({fieldId: 'total'}),
status: creditMemo.getValue({fieldId: 'status'})
};
return {
success: true,
creditMemo: creditMemoData
};
} catch (e) {
log.error('Error retrieving Credit Memo', e);
return {
success: false,
error: {
code: e.name,
message: e.message
}
};
}
}
// RESTlet entry points
return {
post: doPost,
get: doGet
};
});
Tyn Guardian
05/11/2025, 2:12 PMvar deltaRecord = record.create({
type: 'customrecord_feature',
isDynamic: true
});
Emanuel V
05/12/2025, 12:20 PMdh_1101
05/12/2025, 6:22 PMvar inventoryLineCount = ia.getLineCount({ sublistId: 'inventory' });
var inventoryLines = [];
for (var i = 0; i < inventoryLineCount; i++) {
var lineData = {};
var lineFields = ia.getSublistFields({ sublistId: 'inventory' });
log.debug('lineFields', lineFields);
lineFields.forEach(function(fieldId) {
lineData[fieldId] = ia.getSublistValue({
sublistId: 'inventory',
fieldId: fieldId,
line: i
});
});
inventoryLines.push(lineData);
}
return ({
recordId: recordId,
bodyFields: bodyFieldValues,
inventoryLines: inventoryLines
});
}
Shubham Jadhav
05/12/2025, 9:23 PMBryan Miller
05/13/2025, 5:41 PMCraig
05/13/2025, 11:06 PMScot Sunnergren
05/15/2025, 2:59 PMAlan Fitch
05/15/2025, 6:41 PMRyan Longenecker
05/16/2025, 5:39 PMMarc
05/18/2025, 8:26 PMAnek Porwal
05/19/2025, 12:41 PMM Ureddy17
05/19/2025, 5:43 PMSarim Khan
05/20/2025, 6:54 AMHMAC-SHA256
and N/crypto
. I’ve followed the standard OAuth flow: building the base string, signing with the key, and encoding the header. But the response from the target account either shows an auth error or nothing at all.
Has anyone successfully made a SuiteScript-to-SuiteScript cross-account call using OAuth 1.0? If so, I’d really appreciate:
• A working example of generating the OAuth header using N/crypto
• Any gotchas around formatting the Authorization
header for NetSuite RESTlets
• Advice on cross-account permissions or setup (token roles, integration records, etc.)
Thanks in advance!sonu kumar
05/20/2025, 9:29 AMShob S
05/20/2025, 3:10 PMCraig
05/21/2025, 10:13 AMVishal Chaudhari
05/21/2025, 11:34 AMSim Greenbaum
05/21/2025, 4:03 PMcweier
05/21/2025, 11:05 PMLuis
05/22/2025, 3:04 AM