当前位置:网站首页>Salesforce file (II) custom development fileUpload
Salesforce file (II) custom development fileUpload
2022-06-23 02:12:00 【repick】
Use 【lightning-file-upload】 Custom development of tags .
fileUploadLWC.html
<template>
<lightning-card title="LWC File Upload Example" icon-name="custom:custom19">
<lightning-file-upload
label="Attach receipt"
name="fileUploader"
accept={acceptedFormats}
record-id={recordId}
onuploadfinished={handleUploadFinished}
multiple>
</lightning-file-upload>
</lightning-card>
</template>fileUploadLWC.js
import { LightningElement, api } from 'lwc';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
export default class FileUploadLWC extends LightningElement {
@api recordId;
get acceptedFormats() {
return ['.pdf', '.png','.jpg','.jpeg'];
}
handleUploadFinished(event) {
// Get the list of uploaded files
const uploadedFiles = event.detail.files;
let uploadedFileNames = '';
for(let i = 0; i < uploadedFiles.length; i++) {
uploadedFileNames += uploadedFiles[i].name + ', ';
}
this.dispatchEvent(
new ShowToastEvent({
title: 'Success',
message: uploadedFiles.length + ' Files uploaded Successfully: ' + uploadedFileNames,
variant: 'success',
}),
);
}
}fileUploadLWC.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>1. hold Lwc Configuration to Account detailed page On .
2. Effect display
3. Next, let's see where the uploaded files are saved , Follow current Account The relationship between .
i. Start with the current AccountId On condition that , Yes 【ContentDocumentLink】 Perform the following search .
SELECT Id, LinkedEntityId, ContentDocumentId, IsDeleted, SystemModstamp, ShareType, Visibility FROM ContentDocumentLink where LinkedEntityId = '0016g000005bsfJAAQ'
ContentDocumentId: 0696g00000G0xO1AAJ,0696g00000I0rkiAAB,0696g00000I2Fa0AAF
ii. Then the search result of the above side is a conditional pair Object【ContentDocument】 Search
SELECT Id, CreatedById, ArchivedDate,
IsDeleted, OwnerId, SystemModstamp, Title,
PublishStatus, LatestPublishedVersionId,
ParentId, LastViewedDate, LastReferencedDate,
Description, ContentSize, FileType
FROM ContentDocument
where Id in ('0696g00000G0xO1AAJ','0696g00000I0rkiAAB','0696g00000I2Fa0AAF')iii. Then the search result of the above side is a conditional pair Object【ContentVersion】 Search
SELECT Id, ContentDocumentId, IsLatest, ContentUrl,
ContentBodyId, VersionNumber, Title
FROM ContentVersion
where ContentDocumentId in ('0696g00000G0xO1AAJ','0696g00000I0rkiAAB','0696g00000I2Fa0AAF')summary , Through the above query , We found that the uploaded files were finally stored in 【ContentDocumentLink】【ContentDocument】【ContentVersion】 In the table .
边栏推荐
- Understand GB, gbdt and xgboost step by step
- Epoll introduction and principle explanation
- 5g spectrum
- 165. cat climbing
- JS to realize the rotation chart (riding light). Pictures can be switched left and right. Moving the mouse will stop the rotation
- Cut! 39 year old Ali P9 saved 150million
- Ugui empty button implementation
- "Initial C language" (Part 2)
- Single chip microcomputer (STC series 8051 core single chip microcomputer)
- 2022-1-12
猜你喜欢

1. Mx6u bare metal program (4) - GPIO module

Nebula operator cloud practice

Stop automatically after MySQL starts (unable to start)

WebService details

Byte order: big endian vs little endian

1. Mx6u startup mode and equipment

Cut! 39 year old Ali P9 saved 150million

How to download online printing on Web pages to local PDF format (manual personal test)

For Xiaobai who just learned to crawl, you can understand it after reading it

Constexpr keyword
随机推荐
//1.15 putchar function
2021-11-11
Three methods for solving Fibonacci sequence feibonacci (seeking rabbit) - program design
Bubble sort - double for implementation
Using mock data in vite projects -vite plugin mock
Initial structure
5g spectrum
8. destruct, construct, deep copy, shallow copy, assignment operator overload
Freshman C language summary post (hold change) Part 2 formatted monthly calendar
Third order magic cube formula
4. functions and inline functions with default values for formal parameters
JS request path console reports an error failed to launch 'xxx' because the scheme does not have a registered handler
//1.17 printf function
【CodeWars】 Pete, the baker
Small knowledge points of asset
Detailed explanation of GCC usage
Mongodb aggregate query implements multi table associated query, type conversion, and returns specified parameters.
Docker installs mysql5.7 and mounts the configuration file
Why is BeanUtils not recommended?
Evolution history of mobile communication