URL 'Hacks' in Lightning not possible - any solution please? - Answers - Salesforce Trailblazer Community
Ask Search:
Richard LloydRichard Lloyd 

URL 'Hacks' in Lightning not possible - any solution please?

We currently use what SF call ‘URL Hacks’ – a button, (Content Source=URL) with a web address which takes a parameter – a SF object field, simple example:   https://www.google.co.uk/webhp?q=test{!TEXT(Account.SomeFieldName)} .  This cannot be done in SF Lightning.

I’ve spoken at length to SF Support and several different people, none of whom who’ve offered any solution.
We have many URL buttons on various objects, so this represents a big barrier to our Lightning adoption – something we’re all very keen on.
Can anyone give any advice? Anyone else who has come up with a fix for this issue?  Any future functionality for SF Lightning that will give us similar abilities?

Thanks for your time to read this.
Tom BlamireTom Blamire
Unfortunately URL hacking is not supported in Lightning. You would have to create Publisher Actions/Quick Actions to replicate the same functionality
Pritam ShekhawatPritam Shekhawat
You can use Publisher actions as an alternative to URL hacking.  Take a look Salesforce Wizard's blog on it here (http://thewizardnews.com/2014/01/08/great-url-hack-meet-the-chatter-publisher-action/): 
Richard LloydRichard Lloyd
Thanks for your reply Tom but I've looked into these and whilst you can create records etc with quick actions, you cannot link to an external website and pass e.g. a SF field as a search parameter - as far as I was aware.
Mayank SrivastavaMayank Srivastava
Publisher actions are not an alternative to URL hacks like the one that Richard mentioned. Other than building a custom lightning component or a Flow distributed via a button , I don't see an easy way of replicating it. Though another elegant workaround is having a Visualforce Custom Action but that would need some legwork; unfortunately for a requirement as simple as this.
Pritam ShekhawatPritam Shekhawat
But this URL hack is working fine in lightning. I created this in my dev org 
 https://www.google.co.uk/webhp?q=test{!(Account.Name)} and add a detail page button and add it to account page layout lightning action and it's working fine. 

User-added image

User-added image
Richard LloydRichard Lloyd
Thank you Mayank, I did look into using a flow but couldnt see any components I could use for this use case + didnt want to go down the Visual force route - but thank you for pointing it out.
Richard LloydRichard Lloyd
+ Pritam, this sounds too good to be true :) I will give it another go
Pritam ShekhawatPritam Shekhawat
Sometimes you get stuck by lightning for sure using URL hack, but you can overcome this by using visual force and apex controller also :)
Felipe MalgeroFelipe Malgero
Hello Pritam Shekhawat,

Could you give me details how you did the Action to open windown on google?

I'm trying to do it but no success.

Pritam ShekhawatPritam Shekhawat
@Felipe, You can create a detail page button and paste the URL into formula editor and add it to account page layout lightning action and then give a try.
Felipe MalgeroFelipe Malgero
Working Perfectly!

Thank's for your help!
Pritam ShekhawatPritam Shekhawat
Glad to hear it helped !!
Felipe MalgeroFelipe Malgero

I just made a test and Text Fields are populating correctly but lookup fields are not.

In Lookup Field I cannot pre-define values thru formula.

Do you have a solution for that or should I go thru Process Builder ( when created ) to populate these fields?
Pritam ShekhawatPritam Shekhawat
If you want to auto populate the lookup fields then you can use global action in lightning and you can set the predefined values there.
Felipe MalgeroFelipe Malgero
Ok! I will work around!

Thank's again!
Murugadoss BalasubramanianMurugadoss Balasubramanian
Currently, my team is building a custom process for Opportunity creation, We did use custom component for lookup since it was not available by default in Lightning. Just curious how the pre-population will work for the same. Any suggestions much appreciated. Thanks 
José UreñaJosé Ureña
Hi, i want to help you all with this problem.

I noticed the string after the "aloha#" in the URL just after you use the "global search" on Salesforce Lightning is just a Base64 encoded string, so i entered on a website (https://www.base64encode.org) and pasted that string (remember, after the aloha#) and decoded it, and founded this:

{"componentDef":"forceSearch:search","attributes":{"term":"SEARCH STRING","scopeMap":{"type":"TOP_RESULTS"},"context":{"disableSpellCorrection":false,"SEARCH_ACTIVITY":{"searchId":"df6707e4-b867-a197-925b-557d75cc18dc","startTime":1503500649656,"term":"SEARCH STRING"}}}}

Inmediatelly i gone into "Encode" section of website, and tryed the following string (notice i removed the searchId and startTime parameters):

{"componentDef":"forceSearch:search","attributes":{"term":"SEARCH STRING 2","scopeMap":{"type":"TOP_RESULTS"},"context":{"disableSpellCorrection":false,"SEARCH_ACTIVITY":{"term":"SEARCH STRING 2"}}}}

Then Base64 encoded it and pasted it after the "aloha#" (resulting url was something like:  https://na30.lightning.force.com/one/one.app?source=aloha#THECOMPLETEBASE64ENCODEDSTRING).

And "voila"... Lightning Global Search working as Classic did...

Actually don't tryed on another parts of Lightning but i'm pretty sure it will behave the same.
kunal sachdevakunal sachdeva
Hi José Ureña,

I tried this and it worked for me if I want to search anything in salesforce.

Now I want to do the same for populating New Contact , say for example I When I Click on New contact in SF then I can see new popup open and all the input feids are blank, is there way using your solution I can provide firstname from encoded value and open the contact form?

something like this in screenshot:

User-added image
Joseph JoyJoseph Joy
Does this work for community user licenses or just admin licenses?