当前位置:网站首页>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 .
边栏推荐
- Three methods for solving Fibonacci sequence feibonacci (seeking rabbit) - program design
- 4. functions and inline functions with default values for formal parameters
- JS prototype and prototype chain Paramecium can understand
- Digital circuit logic design
- Special exercise split line-----------------------------
- Application and challenge of ten billion level map data in Kwai security intelligence
- C. Unstable String
- JS case: support canvas electronic signature function on PC and mobile
- Vs Code inadvertently disable error waveform curve
- Performance test -- 14 detailed explanation of performance test report and precautions
猜你喜欢

1. introduction to MySQL database connection pool function technology points

Unique in Pimpl_ PTR compilation errors and Solutions

Dynamic address book in C language (add, delete, modify, check (duplicate), delete, sort and export)

Three methods for solving Fibonacci sequence feibonacci (seeking rabbit) - program design

Custom shapes for ugui skill learning

5g access network and base station evolution

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

Microservice Optimization: internal communication of microservices using grpc

Array part

2022-1-12
随机推荐
Ugui empty button implementation
Digital integrated circuit design process
How are pub and sub connected in ros1?
6. const usage, combination of first and second level pointers
1. Mx6u bare metal program (1) - Lighting master
Operate attribute chestnut through reflection
Download and compile ROS source code
Solve the problem that QQ flash photos cannot be saved
Branch and loop statements (including goto statements) -part2
2D prefix and
On function overloading from several examples
You must know the type and method of urllib
Arm assembly syntax
Deep learning environment configuration (I) installation of CUDA and cudnn
Mobile communication Overview - Architecture
Constexpr keyword
Rebirth -- C language and the story I have to tell (text)
1. Mx6u bare metal program (5) - external interrupt
Rebirth -- millimeter wave radar and some things I have to say
Cmake simple usage