function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VarunCVarunC 

System error occurring when we Edit a Record in Lightning App with Console Navigation

I'm getting multiple system error dialog when trying to execute System Events in Lightning Components (in Console Navigation app).

I've tried a link action and action button, and both return errors. My code is as follows:

Error in using force:navigateToSObject :
On a Link onclick, I'm opening the record's detail view by using force:navigateToSObject event as follows:
var navEvt = $A.get("e.force:navigateToSObject"); 
navEvt.setParams({ "recordId": recordId }); 
navEvt.fire();


And it throw following 2 error dialog, dialog 1 appear first, and then dialog 2 show up after clicking OK on dialog 1:
Error dialog 1:
Uncaught Error in $A.getCallback() [Cannot read property 'setParams' of undefined] throws athttps://pk1-dev-ed.lightning.force.com/auraFW/javascript/h_soHR8Rt2_c3cVcuaSlUA/aura_proddebug.js:18473:9Object.fireEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:159:16 Object.fireTranslatedEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:146:22 Object.fireTranslatedStateEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:177:18 Object.force:navigateToSObject()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:214:18 Object.handleSimpleTranslation()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:135:20


Error dialog 2:
Access Check Failed! EventService.getEventDef():'markup://force:navigateToState' is not visible to 'markup://pk1:ListContactRecord {3:1967;a}'. Object.fireEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:157:22 Object.fireTranslatedEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:146:22 Object.fireTranslatedStateEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:177:18 Object.force:navigateToSObject()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:214:18 Object.handleSimpleTranslation()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:135:20
Error in using force:editRecord :
On a Link onclick, I'm opening edit dialog for the record by using force:editRecord event as follows:
var editRecordEvent = $A.get("e.force:editRecord"); 
editRecordEvent.setParams({ "recordId": recordId }); 
editRecordEvent.fire();



This results in single error dialog, but it still opens up the Edit Modal dialog as well. Edit Record modal appears behind the System Error modal dialog with following error details:
 
Access Check Failed! AttributeSet.get(): attribute 'editOverriddenKeyPrefixes' of component 'markup://one:consoleLayoutContainer {1:0;p}' is not visible to 'markup://one:consoleLayoutContainer {1:0;p}'. Object.hasEditOverride()@https://pk1-dev-ed.lightning.force.com/libraries/one/centerStageLibrary/Record.js:154:29Object.handler_force_editRecord()@https://pk1-dev-ed.lightning.force.com/libraries/one/centerStageLibrary/Record.js:105:28 eval()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:1921:29Object.handleCenterStageEvent()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:1907:17handleCenterStageEvent()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:194:16



I'm running clueless as both these Edit and Record View actions work fine in Lightning Component, when the Lightning App is using Standard Navigation, and breaks with errors in Lightning Appwith Console Navigation in it.

Is there any other way available for accessing record view or edit? I've already tried following:
  1. Setting a direct URL = #/sObject/<recordId>/view
  2. Setting a direct URL = #/sObject/<recordId>/edit
Though, [1] URL works fine and opens record, but [2] still throws same error which happens on force:editRecord event navigation. Plus, I don't think setting direct URL formatting is ideal way to code, it seems more hackishh kind of way to me. Though I surely need some help if someone has ideas on this.
SonamSonam (Salesforce Developers) 
Hi,

I would like to understand more as to how you are getting the recordID for the event  to be able to set the recordID parameter and set it at the time its fired.

Ideally, it has to be something as shown below such that the event recieves the recordID and then set the recordID parameter with its value:

var navEvt = $A.get("e.force:navigateToSObject");
var recordId = cmp.get("v.account.Id"); // this seems to be missing in your code
navEvt.setParams({ "recordId": recordId, "slideDevName": "detail" }); navEvt.fire();


Can you please update your code or share it here where I can see how you are assigning the value of recordID ?
 
VarunCVarunC
Yes that is right. I didn't thought it was relevant since I could fetch and read the record id fine, the event variable "navEvt" is itself being undefined, that's the cause of error.

My variable fetching line was just above the code that executes the force:navigateToSObject event like this:
 
var recordId = component.get("v.currentRecId");
var navEvt = $A.get("e.force:navigateToSObject"); 
navEvt.setParams({ "recordId": recordId }); 
navEvt.fire();

The recordId parameter above has correct record id in code when I debugged it.