Salesforce Lightning - Link Formula Field - salesforce-lightning

I created the formula field below to show the link to a record. It works when I'm on different record, however, if I click the same link on a dashboard, it gives me the following error: URL No Longer Exists. The url adds "desktopDashboards." Can someone help me fix this issue?
HYPERLINK(LEFT($Api.Partner_Server_URL_260, FIND( '/lightning', $Api.Partner_Server_URL_260)) & Id, 'Test')
Record link:
https://company.lightning.force.com/lightning/r/Object__c/(id)/view
Dashboard link (with error message):
https://company.cs21.my.salesforce.com/desktopDashboards/(id)

Hyperlinks can be either relative or absolute (more information on that under the tips for the HYPERLINK documentation). In your case it seems it is a relative URL, and so the behavior can change depending on which page you're viewing the hyperlink. One way to link to a record in Salesforce is simply prepending a slash ("/") to the ID. Here's an example:
HYPERLINK("/" & Id, "test")

Related

Pass reference id from url bar to other internal pages

I am compiling a lead generation landing page and, in the form I have inserted a hidden field which collect whatever is written in the url bar after
"?rel=".
This is done in order to track where the leads come from (Facebook ads, direct linking etc).
To be more clear if this is the url: www.mywebsite.com/form.html?rel=fbads
the hidden field will be fill with "fbads" and this is working.
In the landing page I have a link to another page with more details and in this webpage I have the same form.
My idea is to run campaings on the first page with the rel link, but then if the user clicks on the link and go to the detailed page (and then compile the form from there), I am losing the rel field.
How can I pass the rel field to the url of the second page?
Thanks
You may refer the this stackoverflow page. Once the HTTP GET request comes, traverse in HTTP headers in your controller and look for Referer field but it is not always set and the client can change the header value. May be using google analytics is the better option.
If you just want to know that whether if they came to your form page from your landing page or not, you may add fix HTTP URL parameter prior to HTTP redirect.
If you save your rel in a variable, you can add it on your link to detailed page, for example in case of =fbads just once variable is set up, add it: <a href="http://myDetailedPage.com/detailed/?=<?php $rel;?>"</a>

Link query strings get cut off

I'm not aware of link designing strategies, so I am not sure why my link gets chopped off when someone clicks on from sources like Facebook etc.
I have a 'share feature' on my platform, which lets a user create a link to their listing and share it with people.
The link I generate for the listing in my backend has parameters, which reads the listing id and the type and displays content over HTML
Here's a sample link for a listing
https://www.fayvors.com/Share.html?hash=5eccccaa-7b8d-42bd-af8c-08d50da0c867?type=lessons/
However, when I share the link on facebook and click it, the browser redirects to a link that's cut off
https://www.fayvors.com/Share.html?hash=5eccccaa-7b8d-42bd-af8c-08d50da0c867%3Ftype%3Dlessons
I'm not aware of link designing principles, so I'm a bit lost here!
Thanks!
Your URL contains “special characters” (like a second question mark inside the query string), but you neglected to apply proper URL encoding when putting this URL as a parameter value into another URL:
javascript:window.location.replace('https://www.facebook.com/sharer/sharer.php?u='+window.location)
Use encodeURIComponent on the value you are concatenating to the sharer URL here.

Edit a confluence page title to add its ID?

I'm trying to add a unique ID to page titles in confluence.
I managed to add a user macro which uses jQuery to add the page ID & a string prefix to the title;
## #param _prefix:title=Prefix|type=string|required=true|desc=Prefix for the page ID
<script type="text/javascript">
jQuery("document").ready(function() {
if ("${param_prefix}" != "${_prefix}")
jQuery('#title-text a').prepend('${param_prefix}', '$content.getIdAsString()', ' ');
});
</script>
But I want this to actually edit the title, not just get added at runtime. It needs to be consistent throughout, allowing that ID to be a search term & appear in all menus etc.
I can't find anything which suggests this is even possible but it must be, surely!?
$content.setTitle("newtitle") should work. BUT! you will have to make sure that this only happens once, otherwise your title will get repeatedly prepended with your text every time this macro is rendered. I guess you might check if the title starts with your prefix already. And then you might want to add handling of changing the prefix.
See http://confluence.atlassian.com/display/CONF35/Guide+to+User+Macro+Templates#GuidetoUserMacroTemplates-OtherObjectsAvailabletoyourMacro for more details.
That being said, this seems like a pretty kludgey way of solving whatever problem you have. I would suggest reconsidering if this is really what you want to do.
You can use the actual Confluence page ID or the page tiny link rather than generating an ID of your own. Both of these are static.
On any Confluence page, type "k" to see a hyperlink. You might be surprised to see it also contains a tiny link. Atlassian confirms that the tiny link stays the same, even if you move and rename the page (https://jira.atlassian.com/browse/CONF-27049). This is a consistent way to reference the same page with a fixed URL. Another way is to use the Confluence built in PageID.
Confluence Knowledge Base: How to get Confluence page ID
https://confluence.atlassian.com/confkb/how-to-get-confluence-page-id-648380445.html
Ensure that the current user has permissions to View and Edit the
page Navigate to a specific page
Go to Edit Mode by clicking Edit button or press 'e' key
The URL in the address bar will change once you enter Edit Mode
Page ID will be displayed as the parameter in the URL e.g.: When entering Edit Mode, the URL will change to http://my.domain.com/pages/editpage.action?pageId=1540132
In the example above, 1540132 is the Page ID.
To get the page ID with a macro:
ContentEntityObject contentEntityObject = conversionContext.getEntity();
System.out.println("pageId : " + contentEntityObject.getId());
To change a title: content.setTitle("newtitle").
Remember, check if title contains the page id before setting title = title + page ID.

Cannot use named anchors with Facebook tab link

I'm attempting to put a named anchor on a part of our Facebook tab and add "#anchor" to the shared URL so when users click the shared link it will take them directly to the proper content on the tab.
I added to my tab and then recoded the FB Feed Dialog URL so
link=http://www.facebook.com/mybhg?sk=app_279723102083145#quiz
and
actions={name:'name',link:'http://www.facebook.com/mybhg?sk=app_279723102083145#quiz'}
In testing the dialog displayed an error saying both of these were invalid links:
Requires valid redirect URI
actions should be a JSON-encoded dictionary with "name" and "link" keys
So I bit.ly'd them which Facebook accepted and you can share the short URL. When users click the shared link though, the correct URL is used (with "#quiz") but the browser does not snap to the anchor location.
Since FB failed on the original URL, I suspect they aren't set up to parse #named anchors in their URLs, but I wanted to put it out to the community and see if someone has made it work (or confirmed it doesn't.)
Thanks!
URL fragments (the #) can't be read on the server side.
What you can do is use the app_data parameter, which is forwarded to you on the signed_request parameter, parse it accordingly, and have some Javascript to force the jump yourself.

Format of External Links on Facebook

I have seen when you visit a profile on FB and click on link provided in
Contact Information --> Website
Facebook first take you to url format mentioned below
http://www.facebook.com/l.php?u=http%3A%2F%2Fwww.nwaonfire.com%2F&h=BAQByDCFo
and then takes you to the site .
My question is why facebook does so, Iam asking because there is a place in my application where iam allowing users to enter website urls.
...and the reason for facebook using the mentioned link instead of linking directly to http://www.nwaonfire.com is that facebook is evil.
They want to know which links are popular, where their users are going and where the link came from.
I also see a format as http://www.facebook.com/l/BAQByDCFo/www.nwaonfire.com where the BAQByDCFo is a hash value.
URL encoding is done so that a second URL can be placed within the first's query string without breaking the original URL. For example, implying directory structure by using the "/" character or breaking out of name value pair by using "&". If you're going to be embedding a URL as a query string parameter, you must encode it first. How you do this will differ depending on the language you're working with but most web based frameworks have a native or library based function to easily do this.