2

I am building a lightning component to be used in a Customer Service template within a customer community.

I am using following code snippet, to redirect to a knowledge article page, where target url is something like /article/article-unique-url

var forceUrlEvent = $A.get('e.force:navigateToURL');

forceUrlEvent.setParams({
   url: targetUrl,
   isredirect: false
});

forceUrlEvent.fire();

What it internally does on redirection, that it embeds article version id in the URL and URL become something like this:

/article/ka1000000000abc/article-unique-url

It was all working till Friday and suddenly stopped working. Same code is still functional in another sandbox.

As a workaround, I am able to resolve the issue by directly updating "window.location.href" value. But I wanted to understand the nature of the root cause.

  • Have you activated Lightning Knowledge ? – Fabien Taillon May 8 '17 at 10:01
  • As I mentioned in my question, it was working perviously, so yes knowledge is enabled. – Salesforcesmarty May 8 '17 at 11:47
  • I mean, if you go to Setup/Knowledge Settings, is "Enable Lightning Knowledge" checked ? – Fabien Taillon May 8 '17 at 13:42
  • When I said everything was working fine, I actually meant that I can see articles in the community and all their details. – Salesforcesmarty May 9 '17 at 0:33
2

Summer '17 changed the way that Communities handles this. You used to be able to point to the SEO link or the ID and it'd find the right path- but now it's a lot more strict.

Use the navigateToSObject event, or the fully qualified path which is '/article/' + article.Id + '/' + article.UrlName in conjunction with navigateToURL.

  • @Salesforcesmarty this is useful only if it is happening in your sandbox that switched to summer 17 on friday – Itai Shmida May 9 '17 at 6:32
  • @ItaiShmida Community templates are automatically upgraded the moment they're released post Winter '16. – John Au May 9 '17 at 6:51
  • so he actually has a summer 17 community template in his prod? – Itai Shmida May 9 '17 at 6:52
  • @ItaiShmida- look at his first sentence- "I am building a lightning component to be used in a Customer Service template within a customer community."- it clearly implies that he's building a component to be used in a community. Please point out where he said "prod" in the original answer. – John Au May 9 '17 at 11:31
  • Yeah it is on Summer 17 and I reckon, that's why it stopped working. I will try the navigateToSObject event, to see if it meets the redirection thing. Otherwise I have already done the full URL workaround. – Salesforcesmarty May 10 '17 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.