mescalante
08/07/2025, 9:30 PMCeligo AI
08/07/2025, 9:30 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that you want to send an email notification every time an item receipt from a purchase order is done. The email should contain the item name/SKU and transaction date, and it should be sent to two managers. You can achieve this by using SuiteScript's
N/email
module to send the email and N/record
module to access the line items. You can use an afterSubmit User Event Script that triggers every time an item receipt is submitted.
Here is a basic example of how you can do this:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/email', 'N/record'], function(email, record) {
function afterSubmit(context) {
var newRecord = context.newRecord;
var itemId = newRecord.getValue('itemId');
var tranDate = newRecord.getValue('tranDate');
var body = 'Item ID: ' + itemId + ', Transaction Date: ' + tranDate;
email.send({
author: -5,
recipients: ['<mailto:manager1@example.com|manager1@example.com>', '<mailto:manager2@example.com|manager2@example.com>'],
subject: 'Item Receipt Notification',
body: body
});
}
return {
afterSubmit: afterSubmit
};
});
In this script, itemId
and tranDate
should be replaced with the actual field ids of the item name/SKU and transaction date fields. The email addresses should also be replaced with the actual email addresses of the managers.
If you want to use a template for the email body, you can use the N/render
module with a FreeMarker template or an advanced PDF/HTML template. However, if you're not familiar with these, it might be faster to generate the email body via code as shown in the example.
Alternatively, you could create a saved search with a dynamic/relative criteria (like date on or after yesterday) and put a reminder on the dashboard based on this saved search. This way, the managers can see all the item receipts received within a certain window.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/07/2025, 9:30 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825785816
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822379708
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816160619
Celigo AI
08/07/2025, 9:30 PM