we need to have a notification when a check is rep...
# ask-stanley-ai
n
we need to have a notification when a check is reprinted how to do this?
c
AI generated answer (using internal Slack threads):
To set up a notification when a check is reprinted, you can use a combination of SuiteScript and SuiteFlow. Here's a general approach: 1. Create a custom field on the check record to track if it has been printed. This could be a checkbox field that is checked when the check is printed. 2. Create a User Event script that triggers on the 'beforeLoad' event of the check record. In this script, check if the 'printed' field is already checked. If it is, this means the check is being reprinted. 3. If the check is being reprinted, you can use the
N/email
module in SuiteScript to send a notification email. You can customize this email to include any necessary details about the check. Here's a basic example of what the User Event script might look like:
Copy code
javascript
define(['N/email', 'N/record'], function(email, record) {
    function beforeLoad(context) {
        if (context.type !== context.UserEventType.VIEW) return;
        
        var checkRecord = context.newRecord;
        var isPrinted = checkRecord.getValue('custbody_printed'); // replace 'custbody_printed' with your custom field id
        
        if (isPrinted) {
            email.send({
                author: -5, // replace with the ID of the sender
                recipients: '<mailto:example@example.com|example@example.com>', // replace with the recipient's email
                subject: 'Check Reprinted',
                body: 'A check has been reprinted. Check number: ' + checkRecord.getValue('tranid')
            });
        }
    }

    return {
        beforeLoad: beforeLoad
    };
});
Remember to replace the placeholders in the script with your actual field IDs and email addresses. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807277322
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805995047
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805864632
Please provide your feedback on this answer.