Ok, this has been driving me nuts for the past couple of hours and I'm at my wits end. I created a custom application event in a sandbox and deployed it to production. In the sandbox I can call it all day long with no issues. In production I keep getting an undefined value when I use the $A.get function.
I have tried creating a new event "MassUpdate2" directly in production and I can't call it either.
I literally copy and paste the same code that I added into the helper class into production and input it into the same helper class in the sandbox and everything works just fine and dandy.
I've got a total of 3 application events and none of them are being returned when called.
For a little bit of background, the whole reason I have these events is for the functionality that's included as a part of Enhanced Lightning Grid. It has the ability to define actions, which calls application events. I kept getting an error in production, "Invalid event name - cannot identify event". Thus my investigation.
Again, in the Sandbox everything is just fine and dandy. I didn't do the lightning deployment for this org, so I've got to wonder if there's a setting that the previous consultants didn't set? I've done a ton of lightning development and have not run into this before.
Code:
<!--c:MassUpdate.evt-->
<aura:event type="APPLICATION" description="Event will obtain information to push a mass update" access="global">
<aura:attribute name="recordIDs" type="List" access="global" required="true" description="The Id's to update" />
<aura:attribute name="entityApiName" type="String" access="global" required="false" description="The API Name of the object to update" />
<aura:attribute name="fieldSetApiName" type="String" access="global" required="false" description="The API Name of the fieldset with " />
<aura:attribute name="fieldsToDefaultValues" type="Map" access="global" required="false" description="The API Names of the fields with the default value defined for the update, provid in JSON format" />
Test helper:
({
initialize : function(component, event, helper) {
var appEvent = $A.get('e.c:MassUpdate');
console.log('appEvent MassUpdate:');
console.log(appEvent);
}
})
In production the console returns undefined. In the sandbox it returns the expected object.
Assumptions
For starters, I am not using a namespace. This is a regular production org not a dev instance. Thus when I call e.c, it's the correct namespace. Most of the other questions I've seen around this topic have to do with a namespace issue. This is not the case here since you have to have a developer org to have a namespace.
I also don't think this is a callback issue, because again it works in the Sandbox. If it was a callback issue (which is another one of the items I've reviewed), it would presumably happen in the sandbox as well.
Troubleshooting steps and items checked
- I have checked to make sure that the session settings are the same in sandbox and production (just in case).
- The critical updates are also in parallel.
- I also tried setting the API version of the event to 40 just incase it was a bug introduced with Winter 19.
- For giggles and grins I tried switching the event from global to public
- I have tried taking out all attributes and just making it a basic event
- Tested it in the Sales console and outside of it, same result
- Tried different objects (the object I'm trying this on is a managed object, so just in case I used Contact instead)
- Tried using the controller instead of the helper
Does anyone have any other bright ideas? It could be due to the late hour, but I'm honestly at a loss for what else this could be.