How can I have additional info to the memo field a...
# ask-stanley-ai
s
How can I have additional info to the memo field automatically after voiding a customer payment, instead of it just saying VOID?
c
AI generated answer (using internal Slack threads):
To have additional information added to the memo field automatically after voiding a customer payment, you can use a SuiteScript. You can create a User Event script that triggers on the 'afterSubmit' event. This script would check if the transaction has been voided and then append the additional information to the memo field. Here is a basic example of how this could be done:
Copy code
javascript
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */
define(['N/record'], function(record) {
    function afterSubmit(context) {
        if (context.type !== context.UserEventType.DELETE) {
            var newRecord = context.newRecord;
            var voided = newRecord.getValue('voided');
            if (voided) {
                var memo = newRecord.getValue('memo');
                var additionalInfo = ' - Additional Info'; // Replace with your additional info
                newRecord.setValue('memo', memo + additionalInfo);
                record.submitFields({
                    type: newRecord.type,
                    id: newRecord.id,
                    values: {
                        memo: memo + additionalInfo
                    }
                });
            }
        }
    }
    return {
        afterSubmit: afterSubmit
    };
});
This script checks if the transaction has been voided. If it has, it appends the additional information to the memo field. Please replace 'Additional Info' with the information you want to add. ****** 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.845947146
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831481934
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827819824
Please provide your feedback on this answer.