make attachement document is mandatory before save...
# ask-stanley-ai
m
make attachement document is mandatory before save transaction
c
AI generated answer (using internal Slack threads):
To make an attachment document mandatory before saving a transaction, you can use a SuiteScript or a Workflow. For SuiteScript, you can use a User Event script that triggers on the 'beforeSubmit' event. In this script, you can check if there are any attachments on the record. If there are no attachments, you can throw an error to prevent the record from being saved. Here is a sample code snippet:
Copy code
javascript
function beforeSubmit(context) {
    var newRecord = context.newRecord;
    var fileCount = newRecord.getLineCount({sublistId: 'mediaitem'});

    if (fileCount === 0) {
        throw new Error('Please attach a document before saving the record.');
    }
}
For Workflow, you can create a workflow that triggers on the 'Before Record Submit' event. In this workflow, you can add a 'State' with a 'Condition' that checks if there are any attachments on the record. If there are no attachments, you can add an 'Action' to show an error message and stop the workflow. Please note that these solutions will not work with the drag and drop feature. If you are using the drag and drop feature to attach files, you might need to create a custom field for attachments and make it mandatory. Then, you can use a script or a workflow to check if this field is populated before saving the record. ****** 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.814140797
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.811697125
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806681514
Please provide your feedback on this answer.