0

From One LWC I am trying to open the custom object New Creation Page but getting below error :

"This page isn't available in Salesforce Lightning Experience or mobile app"

Below is the codes available: HTML

<lightning-layout-item padding="horizontal-small">
    <lightning-button label="New" onclick={createNewCarType}></lightning-button>
</lightning-layout-item>

JAVASCRIPT

import { NavigationMixin } from 'lightning/navigation';

    {createNewCarType() {
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attribute: {
                objectApiName: 'Car_Type__c',
                actionName: 'new'
            }
        })

    }
}
5
  • are you sure having an object with API name Car_Type__c? Also, check this Mar 25, 2020 at 6:57
  • Yes : happening same issue with the Account
    – Abhijeet
    Mar 25, 2020 at 6:59
  • Where are you using this component? Mar 25, 2020 at 7:08
  • @rahul Thanks I fixed it in attribute there is 's' is missing hence there was an error. It should be attributes instead of attribute
    – Abhijeet
    Mar 25, 2020 at 7:11
  • @Abhijeet if you have found you mistake, you should post it as an answer to make it clear that a question is resolved.
    – Patlatus
    Jan 19, 2021 at 8:50

1 Answer 1

1

Misprint in attribute key should be fixed to attributes

import { NavigationMixin } from 'lightning/navigation';

    {createNewCarType() {
        this[NavigationMixin.Navigate]({
            type: 'standard__objectPage',
            attributes: {
                objectApiName: 'Car_Type__c',
                actionName: 'new'
            }
        })

    }
}

You must log in to answer this question.

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