+ Start a Discussion
ShadowlessKickShadowlessKick 

Lightning work around for URL Hacks

his organization has implemented URL hacks through its Salesforce.com instance. There are several ways that these hacks are executed.  Pre-populating fields on form opening is one of the multiple reasons for the hacks.

For the most part Visualforce pages were avoided.  This allowed the administrators to manage configuration on their own.  After attending Dreamforce '15, the users are now demanding Lightning offering them the same functionality as Classic Salesforce.com.

Please explain the steps it would take to replace these development practices.  It would be hard to believe a huge organization like Salesforce.com would recklessly eliminate a core part of their functionality without a work around.  Cannot find an answer.   

This example scraps the opportunity and pre-populates a custom object with values from the opportunity.  The record is placed in edit mode. The user has the ability to chose wether or not to save it or not.  Please explain the new process that has to take place in steps.  This is an existing javascript button.
var TheMockUpName = "Mock Up: " + "{!Opportunity.Name}";
var TheValues = "{!Opportunity.KCO_Competition_Current_Suppliers__c}";
var TheValueArray = TheValues.split(";");
var TheTarget = "&00N50000002pCh2";
var TheParameters = "";

for (var i=0;i<TheValueArray.length;i++){
TheParameters = TheParameters + TheTarget + "=" + TheValueArray[i] ;
}


var TheAmount = "{!Opportunity.Amount}";
TheAmount = TheAmount.substring(3);
var TheURL = "/a0G/e?CF00N500000026uRE={!Opportunity.Name}&CF00N500000026uR5={!Opportunity.Account}&00N50000002pCi0={!Opportunity.Opportunity_Number__c}&00N50000002pCuV={!Opportunity.KI_Quote__c}&00N500000026uRM={!Opportunity.Sales_Representative__c}&00N50000002pCmW={!Opportunity.District_Name__c}&00N50000002pCmb={!Opportunity.Region__c}" + TheParameters + "&00N500000026uRK=" + TheAmount + "&00N500000026uRK={!Opportunity.Project_Coordinator__c}" + "&Name=" + TheMockUpName + "&retURL=/{!Opportunity.Id}";
window.open( TheURL,"_blank","menubar=yes, location=yes, titlebar=yes, status=yes, toolbar=yes, scrollbars=yes, resizable=yes, top=1, left=1, fullscreen=no" );

Thank you.
Andy BoettcherAndy Boettcher
First off - remember that you will never be able to replicate the same *experience* between URL hacks/Javascript buttons and LEX, but you should be able to acheive the same level of functionality.

You will want to read up on Publisher Actions/Quick Actions.  These Actions are available in Classic, Salesforce1, and LEX.

https://help.salesforce.com/apex/HTViewHelpDoc?id=actions_overview.htm
{tushar-sharma}{tushar-sharma}
Now URL hack is supported in Lightning Experience. You can Set recordType and other fields (Date, DateTime), Clone record as well. Check below post for detail and code sample: 
https://newstechnologystuff.com/2020/06/03/salesforce-url-hack-in-lightning/