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 – sanket kumar Mar 25 '20 at 6:57
  • Yes : happening same issue with the Account – Abhijeet Mar 25 '20 at 6:59
  • Where are you using this component? – sanket kumar Mar 25 '20 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 '20 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 at 8:50
0

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'
            }
        })

    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.