0

currently I need some specific logic which requires using NavigationMixin onsuccess event. I spent some time and can’t find any info if it is possible at all Here is my sample of code

this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: this.__PrimaryObjectApi, actionName: 'new' }, state: { defaultFieldValues: defaultValues } }) 

Will appreciate any help and additional info

1
  • Please explain, what you are trying to do and what is not working? Commented Nov 10, 2022 at 11:57

1 Answer 1

1
  1. Navigate Mixin does not have any onsuccess method

  2. But It returns a promise

  3. Something like this

  4. List item

    this[NavigationMixin.GenerateUrl]({ type: 'standard__objectPage', attributes: { objectApiName: this.__PrimaryObjectApi, actionName: 'new' }, state: { defaultFieldValues: defaultValues }}).then((url) => { this.recordPageUrl = url; }); 
  5. So you need to handle the promise using then block

  6. This would mean that the NavigateMixin was executed succesfully

  7. Else you need to append a catch block which means a error was thrown and the promise was rejected.

1
  • 1
    This answer only deals with GenerateUrl ,but the function in the question ( and the one I am also looking for an answer to) is for Navigate. That does not seem to return a promise unfortunately. Commented Sep 25, 2023 at 12:19

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.