Tim Roberson
09/22/2025, 9:07 PMCeligo AI
09/22/2025, 9:07 PMAI generated answer (using internal Slack threads):To prevent the mileage rate from being changed on an expense report, you can consider implementing a SuiteScript that locks the field once the expense report is created. This way, the mileage rate cannot be edited after the initial entry. Here is a sample SuiteScript code that you can use as a starting point:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/record', 'N/runtime'], function(record, runtime) {
function beforeSubmit(context) {
if (context.type !== context.UserEventType.CREATE) {
var newRecord = context.newRecord;
var oldRecord = context.oldRecord;
var newMileageRate = newRecord.getValue('custrecord_mileage_rate');
var oldMileageRate = oldRecord.getValue('custrecord_mileage_rate');
if (newMileageRate !== oldMileageRate) {
throw 'Mileage rate cannot be changed after creation.';
}
}
}
return {
beforeSubmit: beforeSubmit
};
});
This script will throw an error if a user tries to change the mileage rate after the expense report has been created. Please replace 'custrecord_mileage_rate' with the actual field id of the mileage rate on your expense report 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.
******Celigo AI
09/22/2025, 9:08 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.835144162
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.795043945
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.790405393
Celigo AI
09/22/2025, 9:08 PM