Nicolas Bean
12/08/2022, 8:17 PMeblackey
12/08/2022, 8:20 PMNicolas Bean
12/08/2022, 8:27 PMNicolas Bean
12/08/2022, 8:27 PMNicolas Bean
12/08/2022, 8:27 PMeblackey
12/08/2022, 8:30 PMeblackey
12/08/2022, 8:30 PMNicolas Bean
12/08/2022, 8:33 PMNicolas Bean
12/08/2022, 8:33 PMWatz
12/08/2022, 8:37 PM/**
@NApiVersion 2.x
@NScriptType UserEventScript
@NModuleScope SameAccount
*/
define(["N/record"], function(record) {
function beforeSubmit(context) {
// Get the current sales order record
var currentRecord = context.newRecord;
// Get the ID of the customer associated with the sales order
var customerId = currentRecord.getValue({
fieldId: "entity"
});
// Load the customer record
var customerRecord = record.load({
type: record.Type.CUSTOMER,
id: customerId,
isDynamic: true
});
// Get the current credit limit of the customer
var currentCreditLimit = customerRecord.getValue({
fieldId: "creditlimit"
});
// Check if the credit limit needs to be increased
if (currentCreditLimit < 1000) {
// Increase the credit limit to 1000
customerRecord.setValue({
fieldId: "creditlimit",
value: 1000
});
// Save the updated customer record
customerRecord.save();
}
}
return {
beforeSubmit: beforeSubmit
};
});
Nicolas Bean
12/08/2022, 8:38 PMNicolas Bean
12/08/2022, 8:38 PMNicolas Bean
12/08/2022, 8:38 PMWatz
12/08/2022, 8:39 PMWatz
12/08/2022, 8:42 PMNicolas Bean
12/08/2022, 8:50 PMNicolas Bean
12/08/2022, 8:50 PMNicolas Bean
12/08/2022, 8:51 PMWatz
12/08/2022, 8:52 PMWatz
12/08/2022, 8:54 PMWatz
12/08/2022, 9:15 PMWatz
12/08/2022, 9:16 PMWatz
12/08/2022, 9:25 PMNicolas Bean
12/08/2022, 10:10 PMNicolas Bean
12/08/2022, 10:10 PM