Skip to content

Instantly share code, notes, and snippets.

@Rahman123
Rahman123 / CreditCardSetting.cmp
Created August 17, 2024 05:21 — forked from sfcure/CreditCardSetting.cmp
Lightning Component for Insert/Update Custom Metadata Type Records
<aura:component implements="force:appHostable" controller="CreditCardSettingsController">
<aura:attribute name="data"
type="Object"/>
<aura:attribute name="columns"
type="List"/>
<aura:attribute name="record"
type="Object"/>
@Rahman123
Rahman123 / UploadFile.js
Created May 1, 2024 19:51 — forked from amitastreait/UploadFile.js
Custom File Uploader using Lightning Web Component
import { LightningElement, api } from 'lwc';
import saveTheChunkFile from '@salesforce/apex/FileUploadService.saveTheChunkFile';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
const MAX_FILE_SIZE = 4500000;
const CHUNK_SIZE = 750000;
export default class UploadFile extends LightningElement {
@api recordId;
fileName = '';
@Rahman123
Rahman123 / FileUploadService.java
Created May 1, 2024 19:51 — forked from amitastreait/FileUploadService.java
Custom File Uploader using Lightning Web Component
public with sharing class FileUploadService {
@AuraEnabled
public static Id saveTheChunkFile(Id parentId, String fileName, String base64Data, String contentType, String fileId){
base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
if ( String.isBlank(fileId) ) {
fileId = saveFiles(parentId, fileName, base64Data );
} else {
appendToFile(fileId, base64Data);
@Rahman123
Rahman123 / ContentManager.js
Created January 16, 2024 06:23 — forked from amitastreait/ContentManager.js
How to preview files in Lightning Community using LWC
import { api, LightningElement, track, wire } from 'lwc';
import getContentDetails from '@salesforce/apex/ContentManagerService.getContentDetails';
import deleteContentDocument from '@salesforce/apex/ContentManagerService.deleteContentDocument';
import getLoginURL from '@salesforce/apex/ContentManagerService.getLoginURL';
import { NavigationMixin } from 'lightning/navigation';
const columns = [
{ label: 'Title', fieldName: 'Title', wrapText : true,
cellAttributes: {
iconName: { fieldName: 'icon' }, iconPosition: 'left'
@Rahman123
Rahman123 / content-distribution.cls
Created November 30, 2023 22:47 — forked from lukethacoder/content-distribution.cls
Check and/or Create a ContentDistribution with a ContentDownloadURL (allows for public links of 'Files' in Salesforce)
String linkedEntityId = 'a05B000000ACLmYIAX';
List<ContentDocumentLink> cdl = [
SELECT
ContentDocument.Id, ContentDocument.Title, ContentDocument.FileType, ContentDocumentId
FROM ContentDocumentLink
WHERE LinkedEntityId =: linkedEntityId
];
ContentDocumentLink cdl1 = cdl[0];
<apex:page controller="KGRenewal.ECommerceCartController" showHeader="true" sidebar="true">
{!eCommerceOrder.Name}
</apex:page>
@Rahman123
Rahman123 / TransferSession.page
Created November 16, 2023 22:20 — forked from dsharrison/TransferSession.page
Transfer custom cookies in a community between Lightning and Visualforce with Locker Service enabled.
<apex:page showHeader="false" sidebar="false">
<!--
Replace <your_resource> with the name of the static resource with
your application files in it. This assumes that you are using a zipped static
resource with your javascript files in a 'js/' folder.
-->
<apex:includeScript value="{!URLFOR($Resource.<your_resource>, '/js/transfer-session.js')}" />
</apex:page>
@Rahman123
Rahman123 / ApexUtils.cls
Created April 25, 2023 07:29 — forked from paustint/ApexUtils.cls
Apex Utility Classes / CPQ Quote Calculator Plugin Example
/**
* Utility class for common operations
*
* Any classes that use Schema.SObjectField, this property is object by calling "Schema.Account.Description"
* This allows type safety to ensure that code will not break if fields are changed
* this will not work with person accounts
*
* (c) Advanced Technology Group, 2019
* This code may be used and modified freely as long as this copyright attribution
* is included with the code.
@Rahman123
Rahman123 / FilePreviewAndDownload
Created February 22, 2023 10:06 — forked from LokeshSagi/FilePreviewAndDownload
File Preview and download (all types of contents) in Community
Create these Custom Labels:
Preview_URL:
/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId=
Download_URL:
/community_name/sfc/servlet.shepherd/document/download/