Initial commit: AgentForceTest Salesforce DX project

This commit is contained in:
2026-01-23 20:27:42 +05:30
commit 5f4ee0506f
41 changed files with 10998 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
<template>
<section class="slds-card slds-p-around_medium">
<h2 class="slds-text-heading_medium slds-m-bottom_medium">
Create Person Account
</h2>
<div class="slds-grid slds-wrap slds-gutters">
<div
class="slds-col slds-size_1-of-1 slds-medium-size_1-of-2 slds-p-bottom_small"
>
<lightning-input
type="text"
name="firstName"
label="First Name"
value={firstName}
onchange={handleInputChange}
>
</lightning-input>
</div>
<div
class="slds-col slds-size_1-of-1 slds-medium-size_1-of-2 slds-p-bottom_small"
>
<lightning-input
type="text"
name="lastName"
label="Last Name"
value={lastName}
required
onchange={handleInputChange}
>
</lightning-input>
</div>
<div
class="slds-col slds-size_1-of-1 slds-medium-size_1-of-2 slds-p-bottom_small"
>
<lightning-input
type="email"
name="email"
label="Email"
value={email}
onchange={handleInputChange}
>
</lightning-input>
</div>
</div>
<div class="slds-m-top_large slds-grid slds-grid_align-end">
<lightning-button
variant="brand"
label="Continue"
title="Continue"
onclick={handleContinue}
disabled={isContinueDisabled}
>
</lightning-button>
</div>
<template if:true={message}>
<div class="slds-m-top_medium">
<lightning-formatted-text value={message}></lightning-formatted-text>
</div>
</template>
</section>
</template>

View File

@@ -0,0 +1,79 @@
import { LightningElement, track } from "lwc";
import { ShowToastEvent } from "lightning/platformShowToastEvent";
/**
* Account Quick Create (Standalone Inputs)
* - Standalone lightning-input fields for First Name, Last Name, and Email
* - No LDS save; exposes values and basic validation
*/
export default class AccountQuickCreate extends LightningElement {
@track message;
@track firstName = "";
@track lastName = "";
@track email = "";
get isContinueDisabled() {
// Require Last Name per standard person-name requirements; email optional here
return !this.lastName;
}
handleInputChange(event) {
const { name, value } = event.target;
if (name === "firstName") {
this.firstName = value;
} else if (name === "lastName") {
this.lastName = value;
} else if (name === "email") {
this.email = value;
}
this.message = undefined;
}
handleContinue() {
// Basic validation: enforce Last Name
if (!this.lastName) {
this.dispatchEvent(
new ShowToastEvent({
title: "Validation",
message: "Last Name is required.",
variant: "warning"
})
);
return;
}
// Email validation
if (this.email && !this.isValidEmail(this.email)) {
this.dispatchEvent(
new ShowToastEvent({
title: "Validation",
message: "Please enter a valid email address.",
variant: "warning"
})
);
return;
}
// Example: expose collected values (could dispatch custom event to parent)
const detail = {
firstName: this.firstName?.trim(),
lastName: this.lastName?.trim(),
email: this.email?.trim()
};
this.dispatchEvent(
new CustomEvent("contactinput", {
detail,
bubbles: true,
composed: true
})
);
this.message = `Captured input - First: ${detail.firstName || ""}, Last: ${detail.lastName}, Email: ${detail.email || ""}`;
}
isValidEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
}

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>65.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Account Quick Create (Person Account)</masterLabel>
<description
>LWC to create a Person Account with First Name, Last Name, and Email using standalone inputs.</description>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
<target>lightning__FlowScreen</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordPage">
<objects>
<object>Account</object>
</objects>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>