I have encountered the same problem as the unanswered question found here: backgroundContext not working for Edit NavigationMixin LWC
backgroundContext does not appear to work in this scenario - so I have tried many other parameters to no success:
- inContextOf - a base64 encoded string of a page reference. I have used this successfully in Aura components
- saveNewUrl - similar to backgroundContext, does not work. found from a record type selection screen url:
Some guessed urls based off what I've seen can be used in class:
- cancelUrl - similar to backgroundContext, does not work
- saveUrl- similar to backgroundContext, does not work
Is there any state variable that anyone can suggest? This state object is highly undocumented and has been a process of trial and error getting this to work in LWC.
let pageReference = {
type: 'standard__recordPage',
attributes: {
recordId: contactId,
objectApiName: 'Contact',
actionName: 'edit'
},
state: {
nooverride: '1'
//,backgroundContext: testUrl //works for view
//,inContextOfRef: '1.' + window.btoa(JSON.stringify(inContextOf))
//,saveNewUrl: testUrl
//,saveUrl: testUrl
//,cancelUrl: testUrl
}
};