Hello World
09/24/2021, 8:27 AM/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
* @NModuleScope SameAccount
* @appliedtorecord customer
*/
define(['N/record', 'N/https'], function (record, https) {
function handleAfterSubmit(context) {
var newRecord = context.newRecord
var internalID = newRecord.id
var companyName = newRecord.getValue('companyname')
// Retrive a value from the sublist line
var labelValue = newRecord.getSublistValue({
sublistId: 'addressbook',
fieldId: 'label',
line: 0
})
var addressId = newRecord.getSublistValue({
sublistId: 'addressbook',
fieldId: 'addressid',
line: 0
})
var addrTextValue = newRecord.getSublistValue({
sublistId: 'addressbook',
fieldId: 'addressbookaddress_text',
line: 0
})
// Retrieve the subrecord associated with that same line.
var subrec = newRecord.getSublistSubrecord({
sublistId: 'addressbook',
fieldId: 'addressbookaddress',
line: 0
})
var cityValue = subrec.getValue({
fieldId: 'city'
})
var countryValue = subrec.getValue({
fieldId: 'country'
})
var attentionValue = subrec.getValue({
fieldId: 'attention'
})
var addr1Value = subrec.getValue({
fieldId: 'addr1'
})
var addr2Value = subrec.getValue({
fieldId: 'addr2'
})
var stateValue = subrec.getValue({
fieldId: 'state'
})
var zipValue = subrec.getValue({
fieldId: 'zip'
})
return {
afterSubmit: handleAfterSubmit
}
})
I want to use the addressId but during the create of customer from the ui it is always null but during the update it returns the value.
How can I use the addressId during the create of customer?
I am new to this so help is appreciated.battk
09/24/2021, 9:30 AMbattk
09/24/2021, 9:31 AMbattk
09/24/2021, 9:32 AMbattk
09/24/2021, 9:32 AMHello World
09/24/2021, 10:34 AMHello World
09/24/2021, 12:00 PMbattk
09/24/2021, 12:06 PMHello World
09/24/2021, 12:08 PMbattk
09/24/2021, 12:11 PMHello World
09/24/2021, 12:13 PM