Kamonmanee Wangruammit
02/10/2025, 4:19 AMCeligo AI
02/10/2025, 4:19 AMAI generated answer (using internal Slack threads):To set up an advanced running number for running year and month in journal entries, you can use a combination of SuiteScript and custom fields. Here's a general approach: 1. Create a custom field on the transaction record where you want to store the advanced running number. This field will hold the auto-generated number. 2. Write a SuiteScript that triggers before record submission (beforeSubmit user event script). This script will generate the advanced running number based on your specific rules (e.g., current year and month, sequential number, etc.) and populate the custom field you created in step 1. Please note that this approach requires SuiteScript knowledge and might need to be adjusted based on your specific requirements. Also, be aware that if you have lots of concurrent transaction creation, you might run into issues with the sequence of the numbers. Here's a very basic example of what the SuiteScript might look like:
javascript
function beforeSubmit(context) {
if (context.type !== context.UserEventType.CREATE)
return;
var record = context.newRecord;
var currentYear = new Date().getFullYear();
var currentMonth = new Date().getMonth() + 1; // JavaScript months are 0-based
var sequenceNumber = getSequenceNumber(); // You need to implement this function
var advancedRunningNumber = 'FY' + currentYear + '_' + currentMonth + '_' + sequenceNumber;
record.setValue('custbody_advanced_running_number', advancedRunningNumber);
}
Remember, this is a simplified example and doesn't include error handling, the getSequenceNumber
function implementation, or other best practices. You'll need to adjust and expand this code to fit your needs.
******
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
02/10/2025, 4:19 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812803864
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.808876157
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.79909426
Celigo AI
02/10/2025, 4:19 AMCeligo AI
02/10/2025, 4:21 AMCeligo AI
02/10/2025, 4:21 AM