当前位置:网站首页>Salesforce开发之 如何实现DML操作时,当前用户跳过验证规则(Validation Rule)
Salesforce开发之 如何实现DML操作时,当前用户跳过验证规则(Validation Rule)
2022-08-08 19:01:00 【zcx】
public static void ignoreValidationRules(List<Sobject> dmlList, String dmlType) {
//跳过验证规则
GlobalSetting__c gs;
GlobalSetting__c oldGS;
List<GlobalSetting__c> gsList = [SELECT Id,
SetupOwnerId,
IgnoreValidation__c
FROM GlobalSetting__c
WHERE SetupOwnerId = :UserInfo.getUserId()];
// 设置当前用户忽略验证规则
if (gsList.size() > 0) {
gs = gsList[0];
} else {
gs = new GlobalSetting__c();
gs.SetupOwnerId = UserInfo.getUserId();
}
oldGS = gs.clone();
gs.IgnoreValidation__c = true;
UPSERT gs;
oldGS.Id = gs.Id;
if (dmlType == 'INSERT') {
insert dmlList;
}
if (dmlType == 'UPDATE') {
update dmlList;
}
if (dmlType == 'DELETE') {
delete dmlList;
}
UPDATE oldGS;
}
边栏推荐
- nyoj 712 Exploring treasure
- 证券开户选哪个券商平台比较好,哪个更安全
- Excuse me, during the mongoshake synchronization process in the shake database, src_mongo hangs up, will the synchronization service not exit?
- Implementing Forward+ in Unity URP
- 进化的黑产 vs 进击的蚂蚁:支付宝的每一次点击,都离不开一张“图”的守护
- 01. Preface
- Vue program of web cache problem after packaging
- 堆排序实现代码
- 视图,索引
- 挖财学堂帮开通的证券账户是真的吗?安全吗
猜你喜欢
The difference between Redis' memory elimination strategy and expired deletion strategy
Azure Neural TTS continues to be updated to help enterprises develop small language markets
软考中级网络工程师全面学习笔记第2版(5万字)+配套视频及课件
PX4-Things you need to know for secondary development of flight control-Cxm
性能优化|从ping延时看CPU电源管理
shell的各种三角形
El - tree set radio, click finish after assemble
el-tree设置单选,点击完成后收起
架构设计基本原则
Architecture Design Fundamentals
随机推荐
CAD进阶练习(二)
MogDB学习笔记-从0开始
十六、一起学习Lua 文件 I/O
期货开户哪家公司好,要正规安全的
无标题文章
PX4-Things you need to know for secondary development of flight control-Cxm
[MRCTF2020]你传你码呢
什么是Shell?从小白到入门你只差一个它
Learn about layered architecture & SOA architecture together
shell九九乘法口诀表
Rethinking HTAP database caused by rereading GPDB and TiDB papers
Monaco-Editor Multiplayer Collaboration Editor
文档管理系统对于企业来说有哪些作用?
n个数取出r个数排列
第4讲:SQL语句之DDL类型的数据库定义语言
BP neural network
nyoj 712 探 寻 宝 藏(双线dp 第六届河南省程序设计大赛)
软考中级网络工程师全面学习笔记第2版(5万字)+配套视频及课件
Lecture 4: Database Definition Language of DDL Type of SQL Statements
How is the private key generated by OpenSSH used in putty?