Skip to content

Instantly share code, notes, and snippets.

View salesforce-casts's full-sized avatar
🏠
Working from home

Salesforce Casts salesforce-casts

🏠
Working from home
View GitHub Profile
@InvocableApex
public void processEmailWithAttachment(){
//Attachement Part
List<Messaging.Emailfileattachment> fileAttachments = new List<Messaging.Emailfileattachment>();
Map<Id,ContentDocumentLink> mapContDocuLink = new Map<Id,ContentDocumentLink>([Select Id, ContentDocumentId FROM
ContentDocumentLink
WHERE LinkedEntityId=:oppDetails.Id ]);
@salesforce-casts
salesforce-casts / app.html
Last active October 11, 2020 05:23
Basic event handling. Not going to bubble though there are event listeners wrapping the button. {bubbles: false, composed : false} [Default config]
<template>
<c-child></c-child>
</template>
<template>
<div onsenddata={handleSendData}>
<div onsenddata={handleSendData}>
<div class="buttonDiv" onsenddata={handleSendData}>
<lightning-button label="send data" onclick={handleClick}></lightning-button>
</div>
</div>
</div>
<!--EventCommunication.html -->
<template>
<lightning-button label="send data" onclick={handleSend}></lightning-button>
</template>
//EventCommunication.js
import { LightningElement } from "lwc";
export default class EventCommunication extends LightningElement {
handleSend() {
this.dispatchEvent(new CustomEvent("senddata"));
}
}
import { LightningElement, track, wire } from 'lwc';
import getContacts from '@salesforce/apex/ExploreCustomContactController.getContacts';
import getContactFields from '@salesforce/apex/ExploreCustomContactController.getContactFields';
import getFieldTypes from '@salesforce/apex/ExploreCustomContactController.getFieldTypes';
export default class ExploreReimplementDataTable extends LightningElement {
@track columns = [
{ label: 'Id', fieldName: 'Id' },
{ label: 'Name', fieldName: 'Name' }
];
public with sharing class ExploreCustomContactController {
public ExploreCustomContactController() {
}
@AuraEnabled
public static Map<String, String> getFieldTypes(List<String> selectedFields){
String objectName = 'Contact';
Map<String, String> fieldTypeMap = new Map<String, String>();
@salesforce-casts
salesforce-casts / AccountContacts.java
Last active June 22, 2020 02:51
1. Query Accounts put it in a map<Id, Rating> 2. Query and get related records, map of account to related records 3. If Rating is Hot then update all the child records with Hot so on and so forth
public class exploreTestOne {
String localAccountId;
Set<Id> accountIds = new Set<Id>();
List<Contact> finalContacts = new List<Contact>();
public Map<Id, List<Id>> accountContacts{set; get;}
Map<Id, String> accountRatingMap = new Map<Id, String>();
public exploreTestOne(){