Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions components/netsuite/actions/get-invoice/get-invoice.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import app from "../../netsuite.app.mjs";

export default {
key: "netsuite-get-invoice",
name: "Get Invoice",
description: "Retrieves an invoice by ID. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html#tag-invoice)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: true,
destructiveHint: false,
openWorldHint: true,
},
props: {
app,
invoiceId: {
propDefinition: [
app,
"invoiceId",
],
},
expandSubResources: {
propDefinition: [
app,
"expandSubResources",
],
},
simpleEnumFormat: {
propDefinition: [
app,
"simpleEnumFormat",
],
},
fields: {
propDefinition: [
app,
"fields",
],
},
},
async run({ $ }) {
const {
app,
invoiceId,
expandSubResources,
simpleEnumFormat,
fields,
} = this;

const response = await app.getInvoice({
$,
invoiceId,
params: {
expandSubResources,
simpleEnumFormat,
fields,
},
});

$.export("$summary", `Successfully retrieved invoice with ID ${invoiceId}`);
return response;
},
};
63 changes: 63 additions & 0 deletions components/netsuite/actions/get-sales-order/get-sales-order.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import app from "../../netsuite.app.mjs";

export default {
key: "netsuite-get-sales-order",
name: "Get Sales Order",
description: "Retrieves a sales order by ID from NetSuite. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html#tag-salesOrder)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: true,
destructiveHint: false,
openWorldHint: true,
},
props: {
app,
salesOrderId: {
propDefinition: [
app,
"salesOrderId",
],
},
expandSubResources: {
propDefinition: [
app,
"expandSubResources",
],
},
simpleEnumFormat: {
propDefinition: [
app,
"simpleEnumFormat",
],
},
fields: {
propDefinition: [
app,
"fields",
],
},
},
async run({ $ }) {
const {
app,
salesOrderId,
expandSubResources,
simpleEnumFormat,
fields,
} = this;

const response = await app.getSalesOrder({
$,
salesOrderId,
params: {
expandSubResources,
simpleEnumFormat,
fields,
},
});

$.export("$summary", `Successfully retrieved sales order with ID ${salesOrderId}`);
return response;
},
};
60 changes: 60 additions & 0 deletions components/netsuite/actions/list-invoices/list-invoices.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import app from "../../netsuite.app.mjs";

export default {
key: "netsuite-list-invoices",
name: "List Invoices",
description: "Retrieves a list of invoices from NetSuite. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html#tag-invoice)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: true,
destructiveHint: false,
openWorldHint: true,
},
props: {
app,
searchQuery: {
propDefinition: [
app,
"searchQuery",
],
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of invoices to return",
optional: true,
},
},
async run({ $ }) {
const {
app,
searchQuery,
maxResults,
} = this;

const params = {};
if (searchQuery) params.q = searchQuery;

const items = [];
const paginator = app.paginate({
fn: app.listInvoices,
fnArgs: {
$,
params: Object.keys(params).length > 0
? params
: undefined,
},
maxResults,
});

for await (const item of paginator) {
items.push(item);
}

$.export("$summary", `Successfully retrieved ${items.length} invoice${items.length === 1
? ""
: "s"}`);
return items;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import app from "../../netsuite.app.mjs";

export default {
key: "netsuite-list-sales-orders",
name: "List Sales Orders",
description: "Retrieves a list of sales orders. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html#tag-salesOrder)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: true,
destructiveHint: false,
openWorldHint: true,
},
props: {
app,
searchQuery: {
propDefinition: [
app,
"searchQuery",
],
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of sales orders to return",
optional: true,
},
},
async run({ $ }) {
const {
app,
searchQuery,
maxResults,
} = this;

const items = [];
const paginator = app.paginate({
fn: app.listSalesOrders,
fnArgs: {
$,
params: {
q: searchQuery,
},
},
maxResults,
});

for await (const item of paginator) {
items.push(item);
}

$.export("$summary", `Successfully retrieved ${items.length} sales order${items.length === 1
? ""
: "s"}`);
return items;
},
};
9 changes: 9 additions & 0 deletions components/netsuite/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
DEFAULT_LIMIT: 20,
DEFAULT_MAX_RESULTS: 100,
VALIDATION_OPTIONS: {
ERROR: "Error",
WARNING: "Warning",
IGNORE: "Ignore",
},
};
Loading
Loading