We are converting buttons for Lightning and have quite a few buttons on related lists that navigate back to the parent's record. In Salesforce Classic it was as easy as adding the saveURL parameter to the page - for example:


The following code works very well, but I can't get the newly created record to redirect the user back to the NSSO_Parent__c.Id page. (The backgroundContext parameter works, but that is only for hitting cancel.)

+'?defaultFieldValues=NSSO__c=' + NSSO_Parent__c.Id
+'&backgroundContext=%2Flightning%2Fr%2FNSSO_Parent__c%2F'+NSSO_Parent__c.Id+ '%2Fview'
+'&navigationLocation=%2F' + NSSO_Parent__c.Id

As you can see I'm trying to get the user to go back to the original record and I'm trying to utilize the navigationLocation and type parameters, but that doesn't appear to work...

  • 2
    This sounds like it should be converted to a quick action. It pops up a window and you can define the pre-defined fields and fields that show up in the layout. Upon save, you're still on the parent record that you started from. May 27, 2020 at 22:47
  • @KrisGoncalves yeah... we made a decision with respect to adoption/training that related list buttons would be much easier for users... so we’re exploring this option first.
    – rmarq423
    May 28, 2020 at 0:11

2 Answers 2


I would say it's unlikely there is a way to do this at the moment and, even if there is, I'd be worried about it breaking with future releases unless Salesforce explicitly documents it as something for Lightning.

This functionality in Lightning is new with Spring 20 and what they provided seems very specific in their wording and examples - just the ability to pass default field values to a new record.

I would also double check whether backgroundContext actually works. It didn't for me. What I did find was that even without it, clicking cancel brings you to your previous tab which is generally the parent record.

Another reason for my doubts is due to what this button does. It's just passing field values to the standard create record page which always directs the user to the record they created in the UI (ex. when clicking "new" on the related list).

Going off that, we can even look at the createRecord event you can use in Lightning components that passes similar info and has the same limitation (unable to control redirect after save). There's this idea that is asking for this ability specifically in reference to that event. However, even though they're different mechanisms, I would venture a guess that the limitation is related to the standard create page for a new object in Lightning.

The comments on that idea mention it might've worked using a value of "LOOKUP" for navigationLocation, but then newer comments mention it not working. This, again, is why I suggest avoiding using this if you do find a way unless actually documented. For what it's worth, none of the suggestions worked for me.


And for those using navigation in aura, backgroundContext solves the old problem of a blank background when overriding a 'New' action.

var pageReference = {
                "type": "standard__objectPage",
                "attributes": {
                    objectApiName: "Event",
                    actionName: "new",
                    additionalParams: ""
                "state": {
                    navigationLocation: "LIST_VIEW",
                    backgroundContext: "/lightning/o/Event/home",
                    count: "1",
                    nooverride: '1',
                    defaultFieldValues: encodedValues,
                    recordTypeId: eventRecordTypeId

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .