Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Is there something to configure in order to make the navService / lightning:navigation work as expected ?

Asked by Bruce Benedict May 16, 2023 1.1K views 1 answer
Share

About this question

 I work on a SFDX project with one package, and within my aura component, I'm currently having problems with the lightning:navigation element. I followed the docs from Aura Component - Navigation but still my button does not redirect me as expected. Details & what I've tried I do have this line in my aura component :

And then, my js controller does the following :

handleClick: function(cmp, event, helper) { event.preventDefault(); const navService = cmp.find("navService"); const pageReference = { type: 'standard__objectPage', attributes: { objectApiName: 'Account', actionName: 'list' }, state: { filterName: "Recent" } }; console.log(navService); console.log(pageReference); navService.navigate(pageReference); }
So, when I'm clicking the button in my UI, this is the output of the 2 console.log() above :
But no redirection is done. So when I'm clicking my button that is supposed to redirect me to the page pageReference : My navService is well initialised and has a navigate() function and is logged as shown above My pageReference is logged (see console output above, 2nd item)But the line navService.navigate(pageReference); does nothing (no redirection, no error, no log message.)
  • So my questions are : Am I missing something ? Is there something to configure in order to make the navService / lightning:navigation work as expected ?
  • Why is there no redirection when I'm following the exact same code as the documentation ?

More specific details (possibly not relevant)

FYI my aura component (.cmp file) does have an implements key like so : Also, I don't know if this is relevant but my navigate() function of the navService displays the following elements in my console :

Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.invokeGetter

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.