This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void cleanEmailFields(Map < String, List < String >> mSobjField) { | |
// Iterate through SObject->Email Fields | |
for (String sObjName: mSobjField.keySet()) { | |
// Build a list of all fields that need to be queried | |
List < String > lstEmailFields = mSobjField.get(sObjName); | |
// Generate a SOQL query to get records with non null emails | |
String soql = createSOQL(sObjName, lstEmailFields); | |
List < SObject > sObjRecords = new List < SObject > (); | |
// Iterate through SObject records | |
for (SObject sObjRecord: Database.query(soql)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Map < String, List < String >> findAllEmaiLFields() { | |
Map < String, List < String >> mSObjEmailFields = new Map < String, List < String >> (); | |
// Iterate through all SObjects | |
for (SObjectType sObjType: Schema.getGlobalDescribe().values()) { | |
DescribeSObjectResult sObjDescribe = sObjType.getDescribe(); | |
// Avoid objects that cannot be queried or updated. | |
if (!sObjDescribe.isQueryable() || !sObjDescribe.isUpdateable()) continue; | |
String sObjName = sObjDescribe.getName(); | |
// Iterate through all fields | |
for (SObjectField sObjField: sObjDescribe.fields.getMap().values()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global static void init() { | |
// Map of sObject and list of email fields | |
Map < String, List < String >> soEmailFieldMap = findAllEmailFields(); | |
// create dummy emails on Email fields found in the sObjects | |
cleanEmailFields(soEmailFieldMap); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global class CreateDummyEmails implements SandboxPostCopy { | |
init(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContactController { | |
public List<Contact> contactList {get;set;} | |
public ContactController(){ | |
this.contactList = new List<Contact>(); | |
} | |
@AuraEnabled(cacheable=true) | |
public static list<Contact> getContacts(string searchKey){ | |
List<Contact> lst = new List<Contact>([SELECT Id, Name, Title, Phone, Email FROM Contact WHERE Accountid = :searchKey ]); | |
return lst; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*eslint no-console: ["error", { allow: ["warn", "error"] }] */ | |
import { LightningElement, track, wire, api } from 'lwc'; | |
import findContacts from '@salesforce/apex/ContactController.getContacts'; | |
/** The delay used when debouncing event handlers before invoking Apex. */ | |
const DELAY = 300; | |
export default class ApexWireMethodWithParams extends LightningElement { | |
@track searchKey = ''; | |
@api recordId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-card title="Related Contacts" icon-name="custom:custom63"> | |
<div class="slds-m-around_medium"> | |
<template if:true={contacts.data}> | |
<template for:each={contacts.data} for:item="contact"> | |
<p key={contact.Id}>{contact.name}</p> | |
</template> | |
<template iterator:it={contacts.data}> | |
<li class="slds-item" style="list-style-type: none;" key={it.value.Id}> | |
<article class="slds-tile slds-tile_board"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LightningElement, track } from 'lwc'; | |
export default class HelloWorld extends LightningElement { | |
// @track greeting = 'World'; | |
@track firstName = ''; | |
@track lastName = ''; | |
@track showLastNameOnly = false; | |
changeHandler(event) { | |
// this.greeting = event.target.value; | |
const fldValue = event.target.name; | |
if(fldValue === 'first_name') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-card title="HelloWorld" icon-name="custom:custom14"> | |
<div class="slds-m-around_medium"> | |
<p>Hello, {upperCaseName}!</p> | |
<lightning-input name="last_name" label="Last Name" onchange={changeHandler}></lightning-input> | |
<template if:false={showLastNameOnly}> | |
<div> | |
<lightning-input name="first_name" label="First Name" onchange={changeHandler}></lightning-input> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<lightning-card title="CloudFountain" icon-name="custom:custom14"> | |
<div class="slds-m-around_medium"> | |
<p>Hello, {greeting}!</p> | |
</div> | |
</lightning-card> | |
</template> |
NewerOlder