Posts

Record Form

Image
Static ex: Note: When you are using this you cannot customize and add the fields you need. Everything will be added. This needs to be added in record page of component uses force recorded. <template>      <lightning-record-form         record-id= {recordId}         object-api-name= {objectApiName}         columns= "2"         mode= "edit"         layout-type= "Compact" >      </lightning-record-form> </template> import  {  LightningElement ,  api  }  from   'lwc' ; export   default   class   MyComponent   extends   LightningElement  {     @ api   recordId ;     @ api   objectApiName ...

Record Edit Form

Image
Note: the id is fetched from force has record id. You need to place the component in the contact page. Con_ex Template <template>      <lightning-record-edit-form          record-id= {recordId}         object-api-name= "Contact" >              <lightning-messages></lightning-messages>              <lightning-input-field field-name= "FirstName" ></lightning-input-field>              <lightning-input-field field-name= "LastName" ></lightning-input-field>              <lightning-input-field field-name= "Email" ></lightning-input-field>   ...

Application Event

Pubsub js /**  * A basic pub-sub mechanism for sibling component communication  *  * TODO - adopt standard flexipage sibling communication mechanism when it's available.  */ const   events   =  {}; const   samePageRef   =  ( pageRef1 ,  pageRef2 )  =>  {      const   obj1   =   pageRef1 . attributes ;      const   obj2   =   pageRef2 . attributes ;      return   Object .keys ( obj1 )          .concat ( Object .keys ( obj2 ))          .every ( key   =>  {              return   obj1 [ key ]  ===   obj2 [ key ];    ...

Getting Value from UI

Image
Template Scenario 1: <template>      Hello, {greeting}! </template> JS import { LightningElement } from 'lwc';   export default class Hello extends LightningElement {     greeting = 'World'; } O/p Scenario: 2 Hello world with Input Box  <template>      <lightning-card   title = "HelloBinding"   icon-name = "custom:custom14" >          <div   class = "slds-m-around_medium" >              <p> Hello, {greeting}! </p>              <lightning-input                  label = "Name"              ...