0

We have one community and Android app build on Salesforce mobile SDK. In That community, hyperlink is not triggering any action (not opening desired url ) in Android app but working fine in desktop and iOS app. Below is the code snippet.I have provided code snippet of lightning component where the problem lies and controller part where the link is getting generated.

Component :

<aura:renderIf isTrue="{!v.os == 'iOS' || !v.os == 'Android'}"> <a href="{!v.linkMobile}" target="_self">{!v.linkTitle}</a> <aura:set attribute="else"> <a href="{!v.link}" target="_blank">{!v.linkTitle}</a> </aura:set> </aura:renderIf>

Controller :

"recordID" is holding the ID of knowledge article ID and both labels are holding value of ("domain of community"+"/servlet/fileField?entityId=")

component.set("v.link",$A.get("$Label.c.AbPDFUrl")+recId+"&field=Attachment__Body__s");
                   component.set("v.linkTitle",returnValue.Attachment__Name__s);
                        component.set("v.linkMobile",$A.get("$Label.c.AbPDFUrl_For_Mobile")+recId+"&field=Attachment__Body__s");
  • please ensure you provide code samples as code snippet instead of screenshots, additionally, 'not working' is not very descriptive of the problem or issue, can you please update your post with the behavior? if you notice any error messages, please provide them in your post. Thanks! – glls Apr 4 '19 at 14:43
  • @glls I have updated the post as per your advice. Can you guide to resolve this issue ? – Robecks Apr 5 '19 at 10:09
0

The recommended approach for navigation is to use the onclick event and use a navigation event instead of populating the href with a navigation link.

| improve this answer | |
  • I have implemented onclick event in hyperlink and any url is getting opened now except a specific url which is opening pdf type knowledge article in Android app. Actually we are trying to open knowledge article using this hyperlink. That specific url is - "community url" + "/servlet/fileField?entityId=" + knowledge article ID + "&field=Attachment__Body__s". We open pdf type article using this url in desktop. – Robecks Apr 8 '19 at 5:30
  • can you guide to resolve the problem ? – Robecks Apr 9 '19 at 5:24
  • If you refactored your code and are now using onclick with navigation event, please open a new post with the problem you are facing in order to avoid extended discussions amd keep 1 queston, 1 answer – glls Apr 9 '19 at 12:10
  • Thanks for your advice. I have posted a new case - salesforce.stackexchange.com/questions/257277/… – Robecks Apr 10 '19 at 6:55
  • You are not using lightning navigation events as i mentioned – glls Apr 10 '19 at 11:08

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.