SlideShare une entreprise Scribd logo
1  sur  9
z
親レコード承認申請中
添付ファイルロック不可
への対策案
Created By: Kagawa Hoang
Created Date: 2020/08/30
z
Agenda
1. 承認プロセスのロック仕組みについて
2. 承認申請中ファイルロック不可の課題
3. 承認申請中ファイルロック不可への対策案
4. ソースコード
z
1. 承認プロセスのロック仕組みについて
格納先
ContentDocument:ファイ
ル中身を格納
ContentDocumentLink:
ファイルの共有先を格納
子オブジェ
クト
親
承認申請
子オブジェ
クト
ファイル
オブジェク
ト
主従関係 参照関係 参照関係
一般的に申請確定、回付中、
承認済み申請承認対象レ
コードをロックとする
z
2. 承認申請中ファイルロック不可の課題
格納先
ContentDocument:ファイ
ル中身を格納
ContentDocumentLink:
ファイルの共有先を格納
子オブジェ
クト
親
承認申請
子オブジェ
クト
ファイル
オブジェク
ト
主従関係 参照関係 参照関係
①申請承認レコードをロック際に勝手に主従関係子
レコードも親のロック状態を継承される
②参照関係子レコード又は添付ファイル(参照関
係)が親のロック状態を継承しません。(=>Unlock)
z
3. 承認申請中ファイルロック不可への対策案
「添付ファイルの関連リスト」に
て「ファイルをアップロード」を防
ぐ
「添付ファイルのレコードアクション」関連リストにて「新しいバージョンをアップロード」、「ファイルの詳
細を編集」、「削除」、「レコードから削除」を防ぐ
z
3. 承認申請中ファイルロック不可への対策案
No 防ぐ対象アクション 対策
1 ファイルをアップロード ContentDocumentのBeforeUpdateトリガーにて親レコードの
ロック状態により新規ファイルの添付を防ぐ
2 新しいバージョンをアップロード ContentDocumentのBeforeUpdateトリガーにて親レコードの
ロック状態によりファイルの書き換えを防ぐ
3 ファイルの詳細を編集 ContentDocumentLinkのBeforeUpdateトリガーにて親レコード
のロック状態により添付ファイルの詳細情報更新を防ぐ
4 削除 ContentDocumentのBeforeDeleteトリガーにて親レコードの
ロック状態により添付ファイルの削除を防ぐ
5 レコードから削除 ContentDocumentLinkのBeforeDeleteトリガーにて親レコード
のロック状態によりレコードから添付ファイルの削除を防ぐ
z
4. ソースコード
//セールスフォースのベストプラクティスによりトリガーハンドラーを書いてね!
trigger ContentDocumentTrigger on ContentDocument (before update,before delete) {
if(Trigger.isUpdate ){
for(ContentDocumentLink link:[SELECT Id,ContentDocument.title,ContentDocumentId,ShareType,
LinkedEntity.Name
FROM ContentDocumentLink where ContentDocumentId=: Trigger.newMap.keySet()]){
if(Approval.isLocked(link.LinkedEntityId)){
System.debug(‘新規ファイルの添付又はファイルの書き換え又はファイル削除がダメ’);
trigger.newMap.get(link.ContentDocumentId).addError(‘新規ファイルの添付又はファイルの書
き換え又はファイル削除がダメ'');
}
}
}
if(Trigger.isDelete){
for(ContentDocumentLink link:[SELECT Id,ContentDocument.title,ContentDocumentId,ShareType,
LinkedEntity.Name
FROM ContentDocumentLink where ContentDocumentId=: Trigger.oldMap.keySet()]){
if(Approval.isLocked(link.LinkedEntityId)){
System.debug(‘添付ファイルの削除がダメ');
trigger.oldMap.get(link.ContentDocumentId).addError('添付ファイルの削除がダメ');
}
}
}
}
z
4. ソースコード
//セールスフォースのベストプラクティスによりトリガーハンドラーを書いてね!
trigger ContentDocumentLinkTrigger on ContentDocumentLink (before update, before delete) {
if(Trigger.isUpdate ){
for(ContentDocumentLink rNew : trigger.new)
{
if(Approval.isLocked(rNew.LinkedEntityId)){
System.debug(‘添付ファイルの詳細情報更新がダメ');
rNew.addError('添付ファイルの詳細情報更新がダメ');
}
}
}
if(Trigger.isDelete ){
for(ContentDocumentLink rOld : trigger.old)
{
if(Approval.isLocked(rOld.LinkedEntityId)){
System.debug(‘レコードから添付ファイルの削除がダメ');
rOld.addError('レコードから添付ファイルの削除がダメ');
}
}
}
}
z
4. おしまい
Happy Coding!

Contenu connexe

Tendances

Integrating Fiware Orion, Keyrock and Wilma
Integrating Fiware Orion, Keyrock and WilmaIntegrating Fiware Orion, Keyrock and Wilma
Integrating Fiware Orion, Keyrock and WilmaDalton Valadares
 
DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介
DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介
DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介Microsoft
 
Web and Mobile Application Security
Web and Mobile Application SecurityWeb and Mobile Application Security
Web and Mobile Application SecurityPrateek Jain
 
FIWARE implementation of IDS concepts
FIWARE implementation of IDS conceptsFIWARE implementation of IDS concepts
FIWARE implementation of IDS conceptsfisuda
 
서비스 무중단 마이그레이션 : KT에서 Amazon으로
서비스 무중단 마이그레이션 : KT에서 Amazon으로서비스 무중단 마이그레이션 : KT에서 Amazon으로
서비스 무중단 마이그레이션 : KT에서 Amazon으로신우 방
 
VMware Horizon へ YubiKey を使って認証をキメる話
VMware Horizon へ YubiKey を使って認証をキメる話VMware Horizon へ YubiKey を使って認証をキメる話
VMware Horizon へ YubiKey を使って認証をキメる話Wataru Unno
 
OpenID Connect for W3C Verifiable Credential Objects
OpenID Connect for W3C Verifiable Credential ObjectsOpenID Connect for W3C Verifiable Credential Objects
OpenID Connect for W3C Verifiable Credential ObjectsTorsten Lodderstedt
 
OpenID for Verifiable Credentials
OpenID for Verifiable CredentialsOpenID for Verifiable Credentials
OpenID for Verifiable CredentialsTorsten Lodderstedt
 
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)fisuda
 
コア・コンテキスト管理 - FIWARE WednesdayWebinars
コア・コンテキスト管理 - FIWARE WednesdayWebinarsコア・コンテキスト管理 - FIWARE WednesdayWebinars
コア・コンテキスト管理 - FIWARE WednesdayWebinarsfisuda
 
OpenID Connect: An Overview
OpenID Connect: An OverviewOpenID Connect: An Overview
OpenID Connect: An OverviewPat Patterson
 
Redis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured StreamingRedis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured StreamingDave Nielsen
 
How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...
How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...
How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...Torsten Lodderstedt
 
AWS Black Belt Online Seminar 2018 AWS上の位置情報
AWS Black Belt Online Seminar 2018 AWS上の位置情報AWS Black Belt Online Seminar 2018 AWS上の位置情報
AWS Black Belt Online Seminar 2018 AWS上の位置情報Amazon Web Services Japan
 
DevOpsに求められる様々な技術とその連携の学習方法
DevOpsに求められる様々な技術とその連携の学習方法DevOpsに求められる様々な技術とその連携の学習方法
DevOpsに求められる様々な技術とその連携の学習方法CASAREAL, Inc.
 

Tendances (20)

Integrating Fiware Orion, Keyrock and Wilma
Integrating Fiware Orion, Keyrock and WilmaIntegrating Fiware Orion, Keyrock and Wilma
Integrating Fiware Orion, Keyrock and Wilma
 
DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介
DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介
DXの加速化に力を与えるSQL Serverのモダナイズのオプションを一挙にご紹介
 
Web and Mobile Application Security
Web and Mobile Application SecurityWeb and Mobile Application Security
Web and Mobile Application Security
 
OpenID for SSI
OpenID for SSIOpenID for SSI
OpenID for SSI
 
FIWARE implementation of IDS concepts
FIWARE implementation of IDS conceptsFIWARE implementation of IDS concepts
FIWARE implementation of IDS concepts
 
서비스 무중단 마이그레이션 : KT에서 Amazon으로
서비스 무중단 마이그레이션 : KT에서 Amazon으로서비스 무중단 마이그레이션 : KT에서 Amazon으로
서비스 무중단 마이그레이션 : KT에서 Amazon으로
 
VMware Horizon へ YubiKey を使って認証をキメる話
VMware Horizon へ YubiKey を使って認証をキメる話VMware Horizon へ YubiKey を使って認証をキメる話
VMware Horizon へ YubiKey を使って認証をキメる話
 
OpenID Connect for W3C Verifiable Credential Objects
OpenID Connect for W3C Verifiable Credential ObjectsOpenID Connect for W3C Verifiable Credential Objects
OpenID Connect for W3C Verifiable Credential Objects
 
OpenID for Verifiable Credentials
OpenID for Verifiable CredentialsOpenID for Verifiable Credentials
OpenID for Verifiable Credentials
 
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 1.13.0対応)
 
コア・コンテキスト管理 - FIWARE WednesdayWebinars
コア・コンテキスト管理 - FIWARE WednesdayWebinarsコア・コンテキスト管理 - FIWARE WednesdayWebinars
コア・コンテキスト管理 - FIWARE WednesdayWebinars
 
OWASP Top Ten
OWASP Top TenOWASP Top Ten
OWASP Top Ten
 
OpenID Connect: An Overview
OpenID Connect: An OverviewOpenID Connect: An Overview
OpenID Connect: An Overview
 
Serverless Application Security on AWS
Serverless Application Security on AWSServerless Application Security on AWS
Serverless Application Security on AWS
 
Redis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured StreamingRedis Streams plus Spark Structured Streaming
Redis Streams plus Spark Structured Streaming
 
How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...
How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...
How to Build Interoperable Decentralized Identity Systems with OpenID for Ver...
 
AWS Black Belt Online Seminar 2018 AWS上の位置情報
AWS Black Belt Online Seminar 2018 AWS上の位置情報AWS Black Belt Online Seminar 2018 AWS上の位置情報
AWS Black Belt Online Seminar 2018 AWS上の位置情報
 
イエラエセキュリティMeet up 20210820
イエラエセキュリティMeet up 20210820イエラエセキュリティMeet up 20210820
イエラエセキュリティMeet up 20210820
 
Take-Grant Protection Model
Take-Grant Protection ModelTake-Grant Protection Model
Take-Grant Protection Model
 
DevOpsに求められる様々な技術とその連携の学習方法
DevOpsに求められる様々な技術とその連携の学習方法DevOpsに求められる様々な技術とその連携の学習方法
DevOpsに求められる様々な技術とその連携の学習方法
 

Plus de furuCRM株式会社 CEO/Dreamforce Vietnam Founder

Plus de furuCRM株式会社 CEO/Dreamforce Vietnam Founder (20)

GithubAction+DevOpsCenter.pptx
GithubAction+DevOpsCenter.pptxGithubAction+DevOpsCenter.pptx
GithubAction+DevOpsCenter.pptx
 
BackupMetadataByGitAction.pptx
BackupMetadataByGitAction.pptxBackupMetadataByGitAction.pptx
BackupMetadataByGitAction.pptx
 
Salesforce Flow_InternalTraining.pptx
Salesforce Flow_InternalTraining.pptxSalesforce Flow_InternalTraining.pptx
Salesforce Flow_InternalTraining.pptx
 
FlowErrorHandling.pptx
FlowErrorHandling.pptxFlowErrorHandling.pptx
FlowErrorHandling.pptx
 
DevOpsCenter_BetaVersion.pptx
DevOpsCenter_BetaVersion.pptxDevOpsCenter_BetaVersion.pptx
DevOpsCenter_BetaVersion.pptx
 
Omni-Chanel_ForInternal.pptx
Omni-Chanel_ForInternal.pptxOmni-Chanel_ForInternal.pptx
Omni-Chanel_ForInternal.pptx
 
基本設計+詳細設計の書き方 社内勉強会0304
基本設計+詳細設計の書き方 社内勉強会0304基本設計+詳細設計の書き方 社内勉強会0304
基本設計+詳細設計の書き方 社内勉強会0304
 
SVF cloud for salesforce
SVF cloud for salesforceSVF cloud for salesforce
SVF cloud for salesforce
 
External services
External servicesExternal services
External services
 
Data spider servista for Beginner
Data spider servista for BeginnerData spider servista for Beginner
Data spider servista for Beginner
 
Record level-access in Salesforce
Record level-access in SalesforceRecord level-access in Salesforce
Record level-access in Salesforce
 
Salesforce CMS
Salesforce CMS Salesforce CMS
Salesforce CMS
 
Salesforce Scheduler
Salesforce SchedulerSalesforce Scheduler
Salesforce Scheduler
 
Pardot MA Fundamental
Pardot MA FundamentalPardot MA Fundamental
Pardot MA Fundamental
 
Field service lightning
Field service lightningField service lightning
Field service lightning
 
ETL And Salesforce Integration
ETL And Salesforce IntegrationETL And Salesforce Integration
ETL And Salesforce Integration
 
Sfdx jenkins
Sfdx jenkinsSfdx jenkins
Sfdx jenkins
 
Heroku platform introduction
Heroku platform introductionHeroku platform introduction
Heroku platform introduction
 
Unlocked package
Unlocked packageUnlocked package
Unlocked package
 
Asynchronous apex
Asynchronous apexAsynchronous apex
Asynchronous apex
 

Dernier

Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsWSO2
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイスCRI Japan, Inc.
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptxsn679259
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video UnderstandingToru Tamaki
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Hiroshi Tomioka
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NTT DATA Technology & Innovation
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルCRI Japan, Inc.
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Gamesatsushi061452
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...Toru Tamaki
 

Dernier (12)

Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 

Lock attachfilewhileparentrecordlocked