-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[ACTIONS] Netsuite - new components #19363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jcortes
wants to merge
1
commit into
master
Choose a base branch
from
netsuite-new-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
152 changes: 152 additions & 0 deletions
152
components/netsuite/actions/create-invoice/create-invoice.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| import app from "../../netsuite.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "netsuite-create-invoice", | ||
| name: "Create Invoice", | ||
| description: "Creates a new invoice. [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: false, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| idempotentHint: false, | ||
| }, | ||
| props: { | ||
| app, | ||
| customerId: { | ||
| propDefinition: [ | ||
| app, | ||
| "customerId", | ||
| ], | ||
| }, | ||
| tranDate: { | ||
| type: "string", | ||
| label: "Transaction Date", | ||
| description: "The posting date of this invoice (format: `YYYY-MM-DD`). Defaults to today's date if not specified.", | ||
| optional: true, | ||
| }, | ||
| subsidiaryId: { | ||
| propDefinition: [ | ||
| app, | ||
| "subsidiaryId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| items: { | ||
| type: "string[]", | ||
| label: "Items", | ||
| description: `Array of item objects to add to the invoice. Each item should be a JSON object with the following properties: | ||
|
|
||
| **Required:** | ||
| - \`item\` - Item ID or reference object (e.g., \`{ "id": "123" }\`) | ||
| - \`quantity\` - Quantity to invoice (number) | ||
|
|
||
| **Important Optional:** | ||
| - \`rate\` - Price per unit (number) | ||
| - \`amount\` - Total line amount (number, usually \`quantity * rate\`) | ||
| - \`description\` - Custom description for the line item (string) | ||
| - \`taxCode\` - Tax code ID or reference object | ||
|
|
||
| **Example:** | ||
| \`\`\`json | ||
| [ | ||
| { | ||
| "item": { "id": "456" }, | ||
| "quantity": 2, | ||
| "rate": 99.99, | ||
| "amount": 199.98, | ||
| "description": "Professional services", | ||
| "taxCode": { "id": "5" } | ||
| } | ||
| ] | ||
| \`\`\``, | ||
| optional: true, | ||
| }, | ||
| memo: { | ||
| type: "string", | ||
| label: "Memo", | ||
| description: "A memo to describe this invoice.", | ||
| optional: true, | ||
| }, | ||
| otherRefNum: { | ||
| type: "string", | ||
| label: "PO/Reference Number", | ||
| description: "Customer's purchase order number or other reference number.", | ||
| optional: true, | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include in the invoice as a JSON object. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html) for available fields.", | ||
| optional: true, | ||
| }, | ||
| replace: { | ||
| propDefinition: [ | ||
| app, | ||
| "replace", | ||
| ], | ||
| }, | ||
| propertyNameValidation: { | ||
| propDefinition: [ | ||
| app, | ||
| "propertyNameValidation", | ||
| ], | ||
| }, | ||
| propertyValueValidation: { | ||
| propDefinition: [ | ||
| app, | ||
| "propertyValueValidation", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| customerId, | ||
| tranDate, | ||
| subsidiaryId, | ||
| items, | ||
| memo, | ||
| otherRefNum, | ||
| additionalFields, | ||
| replace, | ||
| propertyNameValidation, | ||
| propertyValueValidation, | ||
| } = this; | ||
|
|
||
| const response = await app.createInvoice({ | ||
| $, | ||
| headers: { | ||
| "X-NetSuite-PropertyNameValidation": propertyNameValidation, | ||
| "X-NetSuite-PropertyValueValidation": propertyValueValidation, | ||
| }, | ||
| params: { | ||
| replace, | ||
| }, | ||
| data: { | ||
| entity: { | ||
| id: customerId, | ||
| }, | ||
| tranDate, | ||
| ...(subsidiaryId && { | ||
| subsidiary: { | ||
| id: subsidiaryId, | ||
| }, | ||
| }), | ||
| ...(items && { | ||
| item: { | ||
| items: utils.parseJson(items), | ||
| }, | ||
| }), | ||
| memo, | ||
| otherRefNum, | ||
| ...(additionalFields && utils.parseJson(additionalFields)), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully created invoice"); | ||
| return response; | ||
| }, | ||
| }; |
128 changes: 128 additions & 0 deletions
128
components/netsuite/actions/create-sales-order/create-sales-order.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import app from "../../netsuite.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "netsuite-create-sales-order", | ||
| name: "Create Sales Order", | ||
| description: "Creates a new sales order. [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: false, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| idempotentHint: false, | ||
| }, | ||
| props: { | ||
| app, | ||
| customerId: { | ||
| propDefinition: [ | ||
| app, | ||
| "customerId", | ||
| ], | ||
| }, | ||
| tranDate: { | ||
| type: "string", | ||
| label: "Transaction Date", | ||
| description: "The posting date of this sales order (format: `YYYY-MM-DD`). Defaults to today's date if not specified.", | ||
| optional: true, | ||
| }, | ||
| subsidiaryId: { | ||
| propDefinition: [ | ||
| app, | ||
| "subsidiaryId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| items: { | ||
| propDefinition: [ | ||
| app, | ||
| "items", | ||
| ], | ||
| }, | ||
| memo: { | ||
| type: "string", | ||
| label: "Memo", | ||
| description: "A memo to describe this sales order. It will appear on reports such as the 2-line Sales Orders register.", | ||
| optional: true, | ||
| }, | ||
| otherRefNum: { | ||
| type: "string", | ||
| label: "PO/Check Number", | ||
| description: "If your customer is paying by check, enter the number here. If your customer is issuing a purchase order, enter the PO number here.", | ||
| optional: true, | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include in the sales order as a JSON object. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html) for available fields.", | ||
| optional: true, | ||
| }, | ||
| replace: { | ||
| propDefinition: [ | ||
| app, | ||
| "replace", | ||
| ], | ||
| }, | ||
| propertyNameValidation: { | ||
| propDefinition: [ | ||
| app, | ||
| "propertyNameValidation", | ||
| ], | ||
| }, | ||
| propertyValueValidation: { | ||
| propDefinition: [ | ||
| app, | ||
| "propertyValueValidation", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| customerId, | ||
| tranDate, | ||
| subsidiaryId, | ||
| items, | ||
| memo, | ||
| otherRefNum, | ||
| additionalFields, | ||
| replace, | ||
| propertyNameValidation, | ||
| propertyValueValidation, | ||
| } = this; | ||
|
|
||
| const response = await app.createSalesOrder({ | ||
| $, | ||
| headers: { | ||
| "X-NetSuite-PropertyNameValidation": propertyNameValidation, | ||
| "X-NetSuite-PropertyValueValidation": propertyValueValidation, | ||
| }, | ||
| params: { | ||
| replace, | ||
| }, | ||
| data: { | ||
| entity: { | ||
| id: customerId, | ||
| }, | ||
| tranDate, | ||
| ...(subsidiaryId && { | ||
| subsidiary: { | ||
| id: subsidiaryId, | ||
| }, | ||
| }), | ||
| ...(items && { | ||
| item: { | ||
| items: utils.parseJson(items), | ||
| }, | ||
| }), | ||
| memo, | ||
| otherRefNum, | ||
| ...(additionalFields && utils.parseJson(additionalFields)), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully created sales order"); | ||
| return response; | ||
| }, | ||
| }; |
38 changes: 38 additions & 0 deletions
38
components/netsuite/actions/delete-invoice/delete-invoice.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import app from "../../netsuite.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "netsuite-delete-invoice", | ||
| name: "Delete Invoice", | ||
| description: "Deletes an existing invoice. [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: false, | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| props: { | ||
| app, | ||
| invoiceId: { | ||
| propDefinition: [ | ||
| app, | ||
| "invoiceId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| invoiceId, | ||
| } = this; | ||
|
|
||
| const response = await app.deleteInvoice({ | ||
| $, | ||
| invoiceId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted invoice with ID ${invoiceId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
38 changes: 38 additions & 0 deletions
38
components/netsuite/actions/delete-sales-order/delete-sales-order.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import app from "../../netsuite.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "netsuite-delete-sales-order", | ||
| name: "Delete Sales Order", | ||
| description: "Deletes an existing sales order in NetSuite. [See the documentation](https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2025.2/index.html)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| readOnlyHint: false, | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| idempotentHint: true, | ||
| }, | ||
| props: { | ||
| app, | ||
| salesOrderId: { | ||
| propDefinition: [ | ||
| app, | ||
| "salesOrderId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| salesOrderId, | ||
| } = this; | ||
|
|
||
| const response = await app.deleteSalesOrder({ | ||
| $, | ||
| salesOrderId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted sales order with ID ${salesOrderId}`); | ||
| return response; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: PipedreamHQ/pipedream
Length of output: 103
🏁 Script executed:
cat -n ./components/netsuite/netsuite.app.mjs | head -150Repository: PipedreamHQ/pipedream
Length of output: 5400
🏁 Script executed:
Repository: PipedreamHQ/pipedream
Length of output: 561
🏁 Script executed:
sed -n '187,195p' ./components/netsuite/netsuite.app.mjsRepository: PipedreamHQ/pipedream
Length of output: 268
🏁 Script executed:
sed -n '265,273p' ./components/netsuite/netsuite.app.mjsRepository: PipedreamHQ/pipedream
Length of output: 253
🏁 Script executed:
sed -n '197,210p' ./components/netsuite/netsuite.app.mjsRepository: PipedreamHQ/pipedream
Length of output: 366
🏁 Script executed:
rg -n "createInvoice|updateInvoice" ./components/netsuite/netsuite.app.mjsRepository: PipedreamHQ/pipedream
Length of output: 123
🏁 Script executed:
sed -n '249,273p' ./components/netsuite/netsuite.app.mjsRepository: PipedreamHQ/pipedream
Length of output: 589
🏁 Script executed:
Repository: PipedreamHQ/pipedream
Length of output: 1179
🏁 Script executed:
cat -n ./components/netsuite/actions/create-invoice/create-invoice.mjs | head -50Repository: PipedreamHQ/pipedream
Length of output: 1941
🏁 Script executed:
sed -n '60,90p' ./components/netsuite/actions/create-invoice/create-invoice.mjsRepository: PipedreamHQ/pipedream
Length of output: 935
🏁 Script executed:
sed -n '85,130p' ./components/netsuite/actions/create-invoice/create-invoice.mjsRepository: PipedreamHQ/pipedream
Length of output: 971
🏁 Script executed:
sed -n '20,60p' ./components/netsuite/actions/update-invoice/update-invoice.mjsRepository: PipedreamHQ/pipedream
Length of output: 1118
🏁 Script executed:
grep -n "async run" ./components/netsuite/actions/update-invoice/update-invoice.mjsRepository: PipedreamHQ/pipedream
Length of output: 89
🏁 Script executed:
sed -n '118,155p' ./components/netsuite/actions/update-invoice/update-invoice.mjsRepository: PipedreamHQ/pipedream
Length of output: 896
🏁 Script executed:
Repository: PipedreamHQ/pipedream
Length of output: 170
$is ignored bydeleteInvoicewith current app signaturedeleteInvoiceis declared as({ invoiceId, opts } = {}), so passing{ $, invoiceId }here sets onlyinvoiceId;$is dropped and_makeRequestfalls back to$ = this. The DELETE request will still execute, but step context and logging are lost. To fix, nest$underopts:const response = await app.deleteInvoice({ - $, invoiceId, + opts: { + $, + }, });Alternatively, update
deleteInvoiceinnetsuite.app.mjsto accept top-level options likecreateInvoicedoes (signature:createInvoice(opts = {})), which would provide consistency across all invoice methods.📝 Committable suggestion
🤖 Prompt for AI Agents