/lwc-auto-create-contact-on-account-without-apex

LWC to create Contact and Account simultaneously without using Apex and establish a relationship between them. If the contact's last name is empty, it will be populated with the account's name

Primary LanguageJavaScript

Auto Create Contact with Account Lightning Web Component (LWC)

This Lightning Web Component (LWC) provides an automated way to create a contact record whenever an account is created in Salesforce. The component ensures that a contact associated with the account is automatically generated, saving time and effort for users.

Auto Create Contact Demo

Table of Contents

Features

  • Automatically creates a contact record when an account is created.
  • The created contact is associated with the corresponding account.
  • Seamlessly integrates into Salesforce Lightning App Pages and Lightning Record Pages.
  • Requires no manual intervention, streamlining data entry processes.
  • Added tooltip help text for Contact Last Name field.
  • Automatically sets Contact Last Name to Account's Last Name if not provided.
  • Added toast messages for success (green) and error (red).

Installation

To use this Lightning Web Component in your Salesforce org, follow these steps:

  1. Clone or Download this Repository:

    • Clone this GitHub repository to your local machine using the following command:
      git clone https://github.com/s4SHIVam7/Auto_Create_Contact_LWC.git
      
  2. Deploy the Lightning Web Component:

    • Deploy the RecordCreatorWithoutApex Lightning Web Component to your Salesforce org.
  3. Add the Component to Your Salesforce Page:

    • Add the RecordCreatorWithoutApex. component to your Lightning App or Record Page.

Usage

  1. Open a Salesforce Lightning Page or App:

    • Navigate to a Salesforce Lightning Page or App where you want to enable automatic contact creation.
  2. Create a New Account:

    • Create a new account as you normally would.
  3. Automated Contact Creation:

    • As soon as you create the account, a corresponding contact is automatically created and associated with that account.

Customization

This Lightning Web Component is designed for a specific use case where a contact needs to be created automatically with each account. There's minimal customization required. However, you can modify the component if needed.

Screenshots

  1. Main Component: image

  2. ToopTip HelpText: image

  3. Error Toast Message (kept accountName as empty): image

  4. Success (Entered Account Name and Contact Name): image

  5. Account & Contact (different name): image

  6. Success (Entered Account Name only): image

  7. Account & Contact (same name) : image

Contact

For questions, support, or feedback, please feel free to reach out: