linavokolans
04/19/2023, 3:30 PM/**
*@NApiVersion 2.x
*@NScriptType UserEventScript
*/
define(['N/record', 'N/log'], function(record, log) {
function beforeSubmit(context) {
if (context.type === context.UserEventType.CREATE) {
// Create a new customer record object
let customerRecord = record.create({
type: record.Type.CUSTOMER
});
let customFieldId = 'url'; // Replace this with the actual script ID of your custom field
// Set the value for the custom field
customerRecord.setValue({
fieldId: customFieldId,
value: '<http://www.google.com|www.google.com>' // Replace this with the text you want to fill in the custom field
});
}
}
return {
beforeSubmit: beforeSubmit
};
});
Anthony OConnor
04/19/2023, 3:35 PMlinavokolans
04/19/2023, 3:35 PMAnthony OConnor
04/19/2023, 3:36 PMlinavokolans
04/19/2023, 3:37 PMAnthony OConnor
04/19/2023, 3:37 PMlinavokolans
04/19/2023, 3:37 PMehcanadian
04/19/2023, 3:44 PMlet
Anthony OConnor
04/19/2023, 3:45 PMlinavokolans
04/19/2023, 3:48 PMlinavokolans
04/19/2023, 3:49 PMlinavokolans
04/19/2023, 3:49 PMShawn Talbert
04/19/2023, 3:52 PMconst
not let
which IIRC would have slipped past SS 2.0 checkingShawn Talbert
04/19/2023, 3:52 PMlinavokolans
04/19/2023, 3:54 PMShawn Talbert
04/19/2023, 3:55 PMlet
in suitescript.linavokolans
04/19/2023, 3:56 PMShawn Talbert
04/19/2023, 3:56 PMconst
🙂Shawn Talbert
04/19/2023, 3:57 PMlet
over var
but with our coding style we almost never need to reach for let
- as a rule everything can be const
- unless we really need to mutate a variable in which case let
stands out like a sore thumb (which is a good thing in that case)Shawn Talbert
04/19/2023, 3:59 PMlinavokolans
04/19/2023, 3:59 PM