Git Product home page Git Product logo

gitthearindam / lwc-new-button-override Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 94 KB

A Hackers’ guide to override “New” button functionality with LWC modal

Home Page: https://medium.com/@arindam-karmakar/a-hackers-guide-to-override-new-button-functionality-with-lwc-modal-a39d35c73bc4

License: MIT License

Shell 0.41% Apex 9.42% JavaScript 67.46% HTML 22.70%
lightning-web-components lwc lwc-component lwc-demo salesforce salesforce-lightning

lwc-new-button-override's Introduction

A Hackers’ guide to override “New” button functionality with LWC modal

Recently in one of my projects I had a requirement to override the standard New button functionality with custom LWC component to accommodate some business logic.

After searching for the solution online, I came to know that:

  1. It is currently not possible to use LWC directly to override the Standard New button. Instead, we have to use an Aura component as a wrapper, and then call the LWC from within the Aura component.

  2. Even if we use this approach, the custom component will open in a new tab instead of a modal, which — albeit working perfectly fine — does not result in a good user experience. As shown below:

Figure 1: Result after overriding Standard New button with LWC wrapped inside Aura Figure 1: Result after overriding Standard New button with LWC wrapped inside Aura

So, I started doing some throwaway prototyping and eventually came up with the solution that I have shared below.

Figure 2: My custom solution with LWC Modal Figure 2: My custom solution with LWC Modal

I'm sharing a link to the detailed article here. Please have a look at this and let me know if you have found any other workaround for this issue.

lwc-new-button-override's People

Contributors

gitthearindam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

chandra1975

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.