Inspired by Brian Kwong‘s creative blog post on “URL Hacking” with supported features in Lightning Experience using a mix of Flow URLs and Lightning Components, I wanted to see if I could solve the problem he posed at the end about providing a reusable solution.
In Brian’s approach, he cleverly used a flow’s URL in a custom button so that he could have a URL to pass parameters to just like the “URL Hacking” days in Classic experience to open a new record form with pre-populated field values. His flow then used a new feature that allows developers to surface components in flow screens by implementing the lighting:availableForFlowScreens interface. His component then fired the force:recordCreate event to pre-populate a new form with default field values passed in from the flow’s URL. Wowza!
URL >> Flow >> Component >> Record Create Form
One of the challenges with variables in flows is that we are limited on the supported data types. Maps, which in Apex and JavaScript are convenient ways to pass a dynamic number and type of variables, is not supported, so by using flow we need to concretely know the number and type of input variables we can pass to the flow and we need to concretely know the number and type of attributes on the Lightning Component we want to pass those flow variables to. Double whammy here by tightly coupling the flow and component to provide one customizable URL. Not very scalable, which Brian points out at the end of his blog post.
Please vote for these ideas to add support for more data types in flows:
Looking for ways to get around the data type limitations of flows, I began thinking of others Salesforce supported ways to create URLs to pass parameters in Lightning Experience. That’s when I remembered a new interface introduced in Summer ’18 lightning:isUrlAddressable. Components that implement this interface are able to be navigated to in Lightning Experience via a URL and they accept an arbitrary number of URL parameters. Bingo!
I started an open source project to build out a proof of concept and I’m quite pleased with how it turned out. I was able to remove the flow from the equation and exclusively use Lightning Components.
URL >> Component >> Record Create Form
However, although I solved one problem (remove data type limitations introduced by using flows), I’ve encountered a new obstacle to the overall user-experience.
By navigating to this lightning component as a URL, you are navigating away from the original page you were on when you clicked the button. The problem with that is there is no way (at the time of this writing) to control what happens when the user clicks the cancel or save buttons in the modal dialog. Meaning, there is no way to return the user back to where they were in my approach. Clicking save will navigate you to the new record, that’s acceptable, but clicking cancel will leave the user on a page that only has the top navigation tabs but no body content. Womp, womp…
Please vote for these ideas for
force:recordCreate
event to expose callbacks to customize the modal dialog button behavior:
Update August 7, 2018
Inspired by reader Suraj Pillai, who suggested doing some navigation trickery asynchronously, I added support for loading the current record in the background while the modal to create a new record appears to the user. By the time the user decides they want to cancel the form, the original record they were working with will have loaded as if the user had never navigated away to begin with.
This record loading is optional in my solution. To use it, add the URL parameter recordId and set the value to the current record being viewed. For example, recordId={!Account.Id}. If you do not specify a recordId parameter, then when the user cancels the form, they will see a blank page like the above screen shot.
Here’s using the recordId parameter in action, note that when clicking the cancel button, the user still is contextually on the original record. Win!
If you have any ideas or solutions to improving in Lightning Experience how to use URLs to pre-populate forms in a dynamic and scalable manner, please let me know in the comments below.
Thanks!
Doug, Thanks for the use case. learnt a few good things around (y)
LikeLiked by 1 person
Glad you liked it, Praveen!
LikeLike
I think I may have a solution, although not very elegant. Accept another urlparam called, let’s say, ‘actiononcancel’ where the user is expected to provide the url of the page they wish to navigate to on cancel. Delay firing the ‘createrecord’ event using ‘setTimeout’ by a couple of seconds and redirect the user to the ‘actiononcancel’ url using ‘force:navigateToURL’ immediately after that line. The user is redirected to the url first and then the ‘force:createRecord’ event is fired so when the user cancels, they stay on the same page.
Something like this:
setTimeout(()=>{$A.get( ‘e.force:createRecord’ ).setParams( eventParamMap ).fire()},2000);
if(urlParamMap.actiononcancel){
helper.navigateToUrl(urlParamMap.actiononcancel);
}
LikeLiked by 1 person
Hi Suraj, thanks for the idea. Assuming the URL they navigate to is in Lightning Experience, then this might work. If they navigate elsewhere then not sure our timeout code will fire. But I’ll try it out. Good to document the workarounds until supported option comes.
LikeLike
You’re right. This would work only with internal urls
LikeLiked by 1 person
Welcome and glad I could help. And thank you for this awesome idea!
LikeLiked by 1 person
Hi Suraj, thanks again for the idea! I’ve updated the end of my blog post with a modified version of using asynchronous behavior to load the cancel action content. Let me know your thoughts =)
LikeLiked by 1 person
Thanks Doug. I like how you used ‘recordid’ instead of a generic url for the cancel action to keep things internal and called ‘navigateToUrl’ before enqueuing the action to replicate the same behavior as setTimeout. The only thing I can think of is if the record create modal were to come up before the navigation action was completed, it would disappear on moving away from the page. And since we the standard enqueueAction does not allow us to specify the timeout, we wouldn’t be able to change the behavior. Not sure how much of a concern that is in practice, though. Again, really good work and appreciate all your contributions to the community!
LikeLiked by 1 person
Hey Doug,
great post. I’ve been waiting for a URL replacement in Lightning for a while.
Now, where can we see the Lightning Component markup and its controller for the given example?
/lightning/cmp/c__URL_CreateRecordCmp?recordId={!Account.Id}&objectName=Contact&FirstName=Doug&LastName=Ayers
Apologies for being thick.
Thanks
Martin
LikeLiked by 1 person
Hi Martin, please see my open source project: https://github.com/douglascayers/sfdx-record-create-url-component
Thanks
LikeLike
Yeah, found it now and managed to get it work as well. So far so good. Will let you know if I discover any issues with it.
LikeLiked by 1 person
This is by far the best alternative to providing data via URL params in Lightning. Thank you for putting it together.
I was not able to get the background record to load, without replacing the Create New form in the foreground. The minute I remove the background record id, create new works as expected. Any idea what I am missing there?
LikeLiked by 1 person
Hi Stefan,
Thanks for the kind feedback, glad you like this solution!
Hrmm.. I’m not sure I follow on what you mean by replacing or removing things in the background/foreground. Do you mean that if you use the recordId URL parameter then it doesn’t work for you?
This is still a bit of a hack, so it’s possible this approach won’t work for everyone.
LikeLike
Yes, when the recordId is provided, the new record popup disappears. As you said, it may not work in all environments.
I am hopeful SF will extend the event handling on force:recodCreate, or allow providing default values on the lightning data service components.
LikeLiked by 1 person
Doug, thanks for this, it looks great. If I wanted the Save action to save the record and then display the same page as the Cancel action does, what modifications would be needed?
LikeLiked by 1 person
Hi Stephen,
To my knowledge, the standard save/cancel dialog buttons are not customizable yet. On save, the page will be redirected to the new record. On cancel, the dialog simply closes, and that is why I employ a trick to load the original record’s page behind the scenes so when the dialog closes the user thinks they stayed on the original page.
Make sure to vote up the ideas mentioned in the blog =)
Thanks
LikeLike
Hey doug i have one workaround
$A.get( ‘e.force:createRecord’ ).setParams(
“panelonDestroyCallBack”:function(cmp){
}
By this method you can control save and cancel behaviour i did it for one of my requirement in the migration of Javascript List buttons
LikeLiked by 1 person
Hi Shubham. Do you have specific examples of how you were able to handle save (capture new record id, and stop the redirect event to the new record)?
LikeLiked by 1 person
Yes steafan give me your email id i will mail u a poc
LikeLike
Interesting, but this is stretching into hacking on internal Salesforce functions which may change or be required for correct operation. Regardless, how do you detect which button was clicked, cancel or save or simply closing the modal? By the name of the function I think this is called anytime the modal is being dismissed for any reason.
LikeLike
Doug!!! if you are clicking on cancel it will redirect you to new record page at that time you will not have any record id so like that i override cancel button and for save you will get the record id so like that you can override save, if you want code so i can give you for understanding……
LikeLike
Shubham,
Can you please provide us the code for this?
Thanks.
LikeLike
Hi Subham,
can you please provide the code to capture record id?
LikeLike
Hi Doug,
Is it possible to use Record Type name instead of a RecordTypeID?
Thanks!
LikeLike
One issue is that save & new does not function with this redirect.
LikeLike
Hey Doug, Enjoying the full scope of your post and advice, 🙂
On URL report, how to manage with filter report. works on Classic but LEX Lightning, Link works but does not filter it the following {!Communities__c.Name}&pv1={!Communities__c.Name}&pv2={!Communities__c.Name} on our report
Example below:
/00OD0000006TaGY?pv0={!Communities__c.Name}&pv1={!Communities__c.Name}&pv2={!Communities__c.Name}
LikeLiked by 1 person
Hi Christophe,
Thanks for the kind feedback. Regarding URLs to reports, I haven’t done much with that in Lightning Experience. You might have some luck exploring this help article.
LikeLike
Hi Doug, Thanks very much for assistance,
I will look at the Help Article.
LikeLiked by 1 person
This is really good! Thanks Doug!
How would you pre populate a date (e.g. Today)?
I’m assuming modifications to the controller?
LikeLiked by 1 person
Hi Adam,
You’re very welcome, glad you like it.
To pre-populate a date field is like pre-populating any other field via the URL. Specify the API Field Name = Some Value where the value is formatted as YYYY-MM-DD where:
YYYY is the four digit year (e.g. 2018)
MM is the one or two digit month (e.g. 4 or 12)
DD is the one or two digit day of the month (e.g. 7 or 28)
For example, to specify an opportunity’s close date to July 12th, 2020 then the URL might look like this:
/lightning/cmp/c__URL_CreateRecordCmp?objectName=Opportunity&recordId={!Account.Id}&CloseDate=2020-07-12
.To specify the opportunity’s close date to “today” then we can’t use {!TODAY()} function alone because that doesn’t format as YYYY-MM-DD, so our URL might look like this:
/lightning/cmp/c__URL_CreateRecordCmp?objectName=Opportunity&recordId={!Account.Id}&CloseDate={!YEAR(TODAY())}-{!MONTH(TODAY())}-{!DAY(TODAY())}
LikeLike
Can it be used opportunity product with passing parameters for product filtering?
LikeLike
Hey @DouglasCAyers – Trying to set up your awesome “URL Hacking” project and, getting a little stuck… – “This page isn’t available in Salesforce Lightning Experience or mobile app.”
Any pointers?
Thanks in advance!
Craig
LikeLike
Hey Doug – Manage to use your awesome project!
I’m having an issue that if the user presses first on anything other than the button and then presses on the button I created – the action doesn’t happen. I see the redirect to the correct URL but nothing shows up.
Tried removing the recordId, changing to 18 char ID but still happens.
Can you suggest any workaround?
Thanks!
LikeLike
Hi Amit,
Did you manage to get a solution regarding the action doesn’t happen?
LikeLike
Hi Dani,
Nope – ended up writing a Lightning Component.
Users kept on mentioning that if they didn’t first press on the button created and touched something else on the page, the button didn’t work any more.
LikeLike
Tried this. Sounds great, but all I get is a new record tab saying ‘Loading…..’, no form for the new record at all. Any thoughts?
LikeLike
Hi Phil, I just released a new version of this solution to try and handle the race condition that would cause the form popup to disappear. Please get the latest code from https://github.com/douglascayers/sfdx-record-create-url-component
Thanks
LikeLike
Hi Doug,
awesome project .. thanks for that. I am using it to start pre-populated standard “create record“ forms triggered by URL List Buttons on related lists. Not sure if it is because of one of the last SFDC Releases, but the current GitHub version (checkout yesterday) won’t work for me out of the box. Here are my findings:
a) field names as URL parameters need to have a namespace prefix
Due to the documentation (https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation) a URL parameter must have the namespace as a prefix. Instead of “…?objectname=….” you need to use “..?c__objectname=…”.
If you miss to set the namespace prefix, the parameter is removed from the URL and therefore you component cannot extract it.
I fixed that by adding a replace in your URL_createRecordCmpHelper:
lowerKey = lowerKey.replace(‘c__’,”);
That applies to the all items in your urlParamMap and all default values in your eventParamMap
b) field names of custom field ending with “__c” won’t work
Example: “…?c__sapstatus__c=waiting”
(keep in mind we need a prefix “c__” .. the custom field API name is of course “sapstatus__c”)
The URL parameter is removed as well if you keep the “__c”!
My workaround is to use “—c” instead of “__c”. I needed to change that in your URL_createRecordCmpHelper to populate the eventParamMap. In fact I needed two replace operations:
let fieldName_withoutNamespace = fieldName.replace(‘c__’,”);
fieldName_withoutNamespace = fieldName_withoutNamespace.replace(‘–c’,’__c’);
For me a working URL in a URL List Button might look like this:
/lightning/cmp/c__URL_createRecordCmp?c__caseId={!Case.Id}&c__sapstatus—c=waiting ….
c) Second call of the URL List Button won’t work
This might be an SFDC issue but if i use the URL List Button a second time, the URL_createRecordCmp is called and the rendered, but the onInit handler isn’t called at all.
Here are the steps to reproduce it:
– Add a URL List Button to a relatedList on a Record Detail Page which is using your component
– press the button once and create an record, or press cancel – it makes no differences (works as expected)
– return to the parent record (in case of “cancel” your are still there) and press the button again
You will see the the components is called, but the “onInit” handler won’t be called again (you can easily place a console.log into the onInit handler to see that)
Funny fact: If you reload the page, it is working again.
This behaviour is not specific for your component. I used the code example from the documentation (https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation) and I saw the same issue.
Just like the SFDC App container is taking it from local cache …
any ideas?
P.S. Let me know if you need my code changes, but I already mentioned the two locations where I made changes …
Best,
Andreas
LikeLiked by 1 person
Thanks for the feedback, Andreas. I’ll review and follow up.
LikeLike
Hi Doug,
I checked the last issue ( c) second call of the component) with our Product Management for LEX components and here is the solution:
The component you call via URL is not destroyed after you navigate away from the page. Thus it will not be init again after you call it a second time. The documentation (https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation) is telling me that, but I just missed it .. same for you btw 😉
The trick is you have to listen to onPageReferenceChanged and call the same helper function (helper.handleShowCreateForm( component );) you call in the init handler. Now your solution works fine for me … contact me via email if you need more details.
Best,
Andreas
LikeLiked by 2 people
Hi Andres,
Thanks for the follow up. Yes, I believe I need to employ the same workaround as discussed here: https://twitter.com/DouglasCAyers/status/1113418201164124160
Thanks!
LikeLike
Thanks so much for this post. I needed to be able to preserve my old url hack buttons for my users that are still in classic while providing that same functionality for the users that are moving to lightning, and overall I’m very impressed with how this works.
I am running into the issue c) described above, but I’m not practiced enough with writing lightning component code to know where to plug in the following:
“listen to onPageReferenceChanged and call the same helper function (helper.handleShowCreateForm( component );) you call in the init handler.”
Can anyone share with me the revised code from doing this?
Thanks!
Katharine
LikeLike
Hi Katharine,
here is what you have to do:
1. add the onPageReferenceChanged handler to your component.
Example:
…
Implement the handler in your JSController
Example:
({
// this method is called when component initializes
onInit: function( component, event, helper ) {
helper.handleShowCreateForm( component );
},
onPageReferenceChanged : function(component, event, helper) {
helper.handleShowCreateForm( component );
}
})
In fact the onPageReferenceChanged is doing the same as the init handler …
Best,
Andreas
LikeLiked by 1 person
ups .. WordPress removed my first expample .. here it is (replace “(” with “<” and “)” with “>” .. sorry I cannot add html tagged code examples in the reply):
(aura:component controller=”URL_CreateRecordController” implements=”lightning:isUrlAddressable”)
….
(aura:handler name=”init” value=”{!this}” action=”{!c.onInit}”/)
(aura:handler name=”change” value=”{!v.pageReference}” action=”{!c.onPageReferenceChanged}” /)
…..
(/aura:component)
LikeLiked by 1 person
Awesome, thanks so much Andreas!
LikeLiked by 1 person
First, thank you to Doug for sharing this great utility. It was working like a charm until the critical update was applied in our org https://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_forcecom_general_namespace_prefix_cruc_reminder.htm
Also, thank you to Andreas for the suggested resolution. It was a tremendous help.
I’ll just add that if you are working with custom fields from a managed package that have a namespace such as xyz__customfield__c, the double underscore in the package namespace also causes the parameter to drop off so just be sure to replace the double underscore in ‘xyz__’ as well and it it should work again.
LikeLiked by 1 person
Hi Andreas Meyer,
The suggestions and workarounds are awesome.
The termination of the URL parameters is resolved with the suggestion a.
But after having the below code as part of suggestion b (to populate eventParamMap), still, the empty page is left out in the lightning. not sure what is wrong.
By any chance, you have the helper code ready with you and can post it?
let fieldName_withoutNamespace = fieldName.replace(‘c__’,”);
fieldName_withoutNamespace = fieldName_withoutNamespace.replace(‘–c’,’__c’);
LikeLike
This is my helper :
I have replaced lowerKey = lowerKey.replace(‘c__’,””);
And my URL is as follows :
/lightning/cmp/c__URL_CreateRecordCmp?c__recordId={!Account.Id}&c__objectName=Lead&c__recordtypeid=0126F000001iPex&c__LastName=Test
({
handleShowCreateForm: function( component ) {
})
When I click on button pop up of new lead comes but the default values are not getting populated for new Lead.
Please help me with this
LikeLike
I resolved it I haven’t replaced section two in code.
Thanks
LikeLike
This is not working for checkbox fields as if I see console logs I could that for checkbox field the value is 1.
For example :”defaultFieldValues”: {
Phone: “415-240-6590″,
Checkbox:”1”
}
All values except checkbox field value is not getting prepopulated. I even tried putting true or True for checkbox but still it is not prepopulating . Please help me in this.
LikeLike
When passing data, you are always better serializing things even in apex(write a inner “wrapper” class and serialize it) and returning a string to your components. It is possible to serialize apex Maps and even instanciate proper js Map/WeakMap with it(these are better than typescript ones btw). Nte that serializing in apex is kind of intensive on CPU/heap size(not that much) but it has never been relevant to me.
Force:CreateRecord is fine as it is, often I find myself beeing the dev of the team, and having this option to loop back to standard pretty fast is often what’s the best for everyone. If you give too much powers to it, the form behavior would diverge from the standard or alterate it. “Leave The Standard alone!”
On a side note, are you guys aware of lightning quick actions? I genuinly never feels the need of url hacking anything, and when I witness some URL hacking in an org it is on orgs where code base is already very poor.
LikeLike
Hi Nathaniel, thanks for your feedback. This blog post and project is specifically around how to use a URL to pre-populate fields on a standard quick action without the user of this trick having to write any code themselves.
If I understand your position, you opt to write code and invoke APIs and/or use Apex. That is fine too, there are many ways to implement solutions on the platform.
=)
LikeLike
Looks like this breaks with the Summer ’19 critical update: https://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_forcecom_general_namespace_prefix_cruc_reminder.htm
I’m updating my urls to make the parameters use the c__ namespace, but is there anything that needs to be changed in the lightning component code? In the critical update it says:
“If you store values in pageReference.state, update the properties to include a namespace. In this example, update pageReference.state = { foo: true } to pageReference.state = { ns__foo: true }.”
LikeLiked by 1 person
Nevermind, I just saw the changes suggested by Andreas above. I’m not sure that it will work for me since I am trying to amend this to work for either lightning experience or classic by sending the user first to a visualforce page that evaluates the experience that they’re in and then reroutes them from there. But the url parameters are getting stripped out before it even hits the visualforce page so I’m going to have to play around with it a bit to see how to make it work.
LikeLiked by 1 person
Thank you so much for this!
LikeLiked by 1 person
You’re very welcome, Chanida!
LikeLike
Hi All ,
Any suggestions how my below url should be updated,would be helpful for me.
https://kydev–stage.lightning.force.com/lightning/o/Program__c/new?c__recordTypeId=ID&c__accrecordId=!Account.Id&c__companyName=!Account.Name.
Thanks,
Prathyusha
LikeLike
Hi Prathyusha,
first look at the url format to call a lightning component:

you call a standard new handler for your Program__c custom object. Keep in mind: add the namespace to your component name and to all parameters
LikeLike
Hi this component is exactly what I am needing however I am getting
This page ins’t available in Salesforce Lightning Experience or moble app.
Button code is
/lightning/cmp/c__URL_CreateRecordCmp?c__recordId={!Account.Id}&c__objectName=Contact&c__recordTypeId={!Account.ContactRecordTypeId__c}&c__AccountId={!Account.Id}
I have tried this with and without the c__ with the same results.
Account.ContactRecordTypeId is a calculated field on Account providing the corresponding record type for the contact based on record type of the Account.
Any suggestion would be greatly appreciated.
LikeLike
Hi Janette,
ContactRecordTypeId will be ignored .. right? The reason for that: the “__c” part in a custom field developername is the problem. LEX is not parsing these URL parameters at all.
Check my post above: I replaced the “__c” with “–c” and changed the component to handle that.
And btw: you need to pass the namespace (“c__”) for the component name and all URL parameter.
LikeLike
@Doug, @Andreas Meyer,
Thanks for such for great idea.
I am not able to pass custom field via url. All other values get populated in the new create form.
This is key and value in the url
c__customFieldName-c=Unassigned
In the Js Helper, i replace in two different places with __c.
Section -1:
for ( let key in pageRef.state ) {
let lowerKey = key.toLowerCase().replace(/^c__/, “”);
lowerKey = lowerKey.toLowerCase().replace(/-c^/, “c”);
if ( urlParamMap.hasOwnProperty( lowerKey ) ) {
urlParamMap[lowerKey] = pageRef.state[key];
}
}
Am I doing anything wrong? why custom fields does not populated in the new form? Any answer is appreciated
LikeLike
Hello,
I used force:navigateToURL, my URL is like xxxxxxxxx:10080
var eipURL = encodeURI(‘http://xxxxxxxxx:10080’);
var urlEvent = $A.get(“e.force:navigateToURL”);
urlEvent.setParams({
“url”: eipURL });
urlEvent.fire();
When I fire the even I got the “This site can’t be reached” error message. And the URL in the navigator become xxxxxxxxx.10080.
Don’t know why the URL change.
Could you help please.
Thanks
LikeLike
This may be helpful:
I built a workaround to set some lookup defaults when creating a related record of Accounts:
I created a custom object and called it “Default Settings”, in which I could create lookup fields for, and populated them with my desired defaults. This would also allow me to have different defaults for different type of accounts (similar to custom meta data records, which don’t yet allow lookups).
Then, I added a lookup to that “Default Setting” object on Accounts.. I populated all my accounts to lookup to that record. I added a Process Builder to populate the Account.DefaultSetting lookup with the desired record at account creation, so all accounts will always reference a default setting record.
Then, in my Quick Action, I navigate from my account->defaults settings->lookup_field_xyz to populate my lookup in the Quick Action.
LikeLike
@Doug, @Andreas Meyer,
Thanks for such for great idea.
I am not able to pass custom field via url. All other values get populated in the new create form.
This is key and value in the url
c__customFieldName-c=Unassigned
In the Js Helper, i replace in two different places with __c.
Section -1:
for ( let key in pageRef.state ) {
let lowerKey = key.toLowerCase().replace(/^c__/, “”);
lowerKey = lowerKey.toLowerCase().replace(/-c^/, “c”);
if ( urlParamMap.hasOwnProperty( lowerKey ) ) {
urlParamMap[lowerKey] = pageRef.state[key];
}
}
section-2:
// ensure only fields the current user has permission to create are set
// otherwise upon attempt to save will get component error
for ( let key in pageRef.state ) {
let fieldName = key.replace(/^c/, “”);
fieldName = fieldName.replace(/-c^/, “__c”);
if ( fieldDescribeMap.hasOwnProperty( fieldName ) && fieldDescribeMap[fieldName].createable && pageRef.state[key]) {
// avoid setting lookup fields to undefined, get Error ID: 1429293140-211986 (-590823013), assign to null instead
eventParamMap.defaultFieldValues[fieldName] = pageRef.state[key] || null;
}
}
Am I doing anything wrong? why custom fields does not populated in the new form? Any answer is appreciated
LikeLike
Hi Dsivarajan,
try to change your String.Replace parameter… here is what I have in my Helper:
let fieldName_withoutNamespace = fieldName.replace(‘c__’,”);
fieldName_withoutNamespace = fieldName_withoutNamespace.replace(‘–c’,’__c’);
same for the second location:
lowerKey = lowerKey.replace(‘c__’,”);
Best,
Andreas
LikeLike
Hi Andreas,
Thank you for your solutions! I’ve implemented what you’ve provide, accurately – I think (I’m not a developer), but I’m not able to pass in variables with either __c or -c. Also, this url will at least load the form (/lightning/cmp/c__URL_CreateRecordCmp?c__objectName=Account_Note__c&c__RecordId={!Application__c.Id}&c__Note__c=test) whereas this one doesn’t /lightning/cmp/c__URL_CreateRecordCmp?c__objectName=Account_Note-c&c__RecordId={!Application__c.Id}&c__Note-c=test
My helper is below. Thanks regardless!
({
handleShowCreateForm: function( component ) {
})
LikeLike
Hi Doug. I’ve used this solution for one of my clients and it works great in the platform however I’m having a hard time getting it to work in their community. No matter how I format the URL it doesn’t seem to work
Is it possible to utilize this solution in a community?
LikeLike
How to populate Checkbox field value for Lightning URL Hacking.
LikeLike
I am new to Salesforce and lightning development, I tried to copy source code into my instance (Creating the apex class and the lightning component). I added the Detail Page button and added the URL as “/lightning/cmp/c__URL_CreateRecordCmp?objectName=Contact&FirstName=Astro&LastName=Nomical&AccountId={!Account.Id}” but when I click the button on the Account I am navigated to a new window with the “https://test-abc.lightning.force.com/lightning/cmp/c__URL_CreateRecordCmp” there are no parameters and the page looks empty… Can anyone please suggest me what I am missing.
LikeLike
Hi,
Can we do URL hack for Send An Email in Lightning?
I need Model Pop Up of Send An Email.
LikeLike
It worked fine for my sandbox in Salesforce mobile app, however after deploying to other Sandbox there it is not working in mobile app
LikeLike
Hi I have user lightning:actionOverride functionality in my component.
But need to handle cancel and Save & New Button functionality. Can anybody help me on that one.
LikeLike
you cannot overwrite the standard buttons. See here: https://developer.salesforce.com/forums/?id=906F00000008qK8IAI
LikeLike
Hi Andreas , Is there any way we can set the Background as standard component, as currently its coming as blank.
LikeLike
Please find the code for reference
CMP:
Controller :
({
myAction : function(component, event, helper) {
helper.getParameterByName(component , event);
})
Helper :
({
getParameterByName: function(component, event) {
var pageRef = component.get(“v.pageReference”);
var state = pageRef.state; // state holds any query params
var base64Context = state.inContextOfRef;
if (base64Context.startsWith(“1.”)) {
base64Context = base64Context.substring(2);
}
var addressableContext = JSON.parse(window.atob(base64Context));
component.set(“v.recordId”, addressableContext.attributes.recordId);
}
})
LikeLike
Arun .. you can of course add your own “cancel” and “save” button and use a corresponding JS handler in your controller. Keep in mind that the “X” in the upper right corner of your modal won’t call your onCancel JS handler. To use the standard component as a “canvas” and add a AURA component as a “body” is not possible.
LikeLike
Andreas, The Whole component is Standard only thing which i am doing is Pre-populating some of the values. Which is working.
But on cancel need to navigate to the same related list Page. which is causing the issue as its stuck.
I tried below approach but it not working or may be i am missing something.
LikeLike
@Arun panelOnDestroyCallback won’t help you. I assume you open the standard component via “e.force:createRecord” event (and pre-populate filed values in the parameter list). If you do this you might use the undocumented parameter “navigationLocation”: “LOOKUP” as an event parameter. It is still working fine … but keep in mind it is an undocumented parameter for this event.
Here is how I use it. I check if I like to stay on the parent page and set the param accordingly:
and fire the event:
$A.get( ‘e.force:createRecord’ ).setParams( eventParamMap ).fire();
Hope that helps.
LikeLike