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:
&saveURL={!NSSO_Parent__c.Id}
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.)
URLFOR('/lightning/o/NSSO__c/new'
+'?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
+'&type=standard__objectPage'
)
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...