• Deven Damiano
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I'm using the following to open a new record modal on a custom lwc
this[NavigationMixin.Navigate]({
      type: 'standard__objectPage',
      attributes: {
          objectApiName: this.childObjectApiName,
          actionName: 'new'                
      },
      state : {
          count: '1',
          nooverride: '1',
          useRecordTypeCheck : '1',
          defaultFieldValues: inheritParentString,
          navigationLocation: 'RELATED_LIST'
      }
    });

What I need is after the user saves inside of the popup, to run a function that refreshes my lwc component. Unfortunately, I've found no way to trigger anything after the modal is closed. I've tried listening for platform events, appending  .then(result => {}) to the end of the navgation mixin function, but all have failed miserably, and I have lost all hope. Does anyone have any ideas I how to accomplish this? Please help..
I'm using the following to open a new record modal on a custom lwc
this[NavigationMixin.Navigate]({
      type: 'standard__objectPage',
      attributes: {
          objectApiName: this.childObjectApiName,
          actionName: 'new'                
      },
      state : {
          count: '1',
          nooverride: '1',
          useRecordTypeCheck : '1',
          defaultFieldValues: inheritParentString,
          navigationLocation: 'RELATED_LIST'
      }
    });

What I need is after the user saves inside of the popup, to run a function that refreshes my lwc component. Unfortunately, I've found no way to trigger anything after the modal is closed. I've tried listening for platform events, appending  .then(result => {}) to the end of the navgation mixin function, but all have failed miserably, and I have lost all hope. Does anyone have any ideas I how to accomplish this? Please help..
I am writing a custom listner to lightning showtoast in my lwc application. 
constructor() {
        super();
        this.addEventListener('lightning__showtoast', this.handleNotification);
    }

    handleNotification() {
        //do something here
    }

this works fine when I fire the toast event explicitly via code. But when I use the lightning navigation, the standard toast events are fired.

Pop up is opened through the Navigation
navigateToRecordEditPage(event, recordId) {
        event.preventDefault();
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: recordId,
                objectApiName: this.records.relatedSobjectApiName,
                actionName: 'edit'
            }
        });
    }
Once the records are saved, the toast event is fired but same is not caught in the handler created. 
Does anyone have any idea how to make it work for standard toast events as well.