I have Javascript module named constants.js with the following in it:
const coreObjects = {
activity: {
objectName: 'activity',
table: 'activities',
pk: 'activity_id',
recordTypeID: 'A'
}
}
export { coreObjects }
I’m trying to reference the ‘table’ attribute of this constant with the following in a separate script file:
let constants = await import('./constants.js');
let actvityTable = constants.coreObjects.activity.table;
And I get the following error:
TypeError: Cannot read properties of undefined (reading 'activity')
Any thoughts on how I get this to work? Thanks!
When I change to the following it doesn’t generate an error but is not giving me the specific access to the ‘table’ field that I was looking for:
let actvityTable = constants.coreObjects