041_Record Type
应用场景:在使用Apex新建记录时,有时需要根据具体需求为用户匹配对应的记录类型,这个时候就需要用到记录类型Id的情况。
获取RecordTypeId的方法有2种,一种是根据soql进行查询,另一种是使用内置方法查询;
方法1:过滤的是DeveloperName
- Id recordTypeId = [SELECT Id, Name, DeveloperName, isActive
- FROM RecordType
- WHERE DeveloperName ='Tender_Record_Offline_Media' AND SobjectType = 'Advertiser_Tender_Relationship__c' LIMIT 1].Id
方法2:注意传入的是Label Name
- Id devRecordTypeId = Schema.SObjectType.ObjectName.getRecordTypeInfosByName().get('Label Name').getRecordTypeId();
- 如:Id devRecordTypeId = Schema.SObjectType.Advertiser_Tender_Relationship__c.getRecordTypeInfosByName().get('线下媒介-普通').getRecordTypeId();
资源链接:
https://devforce.co/apex-tip-how-to-get-a-recordtype-id-by-name-without-soql/
https://salesforce.stackexchange.com/questions/157608/getrecordtypeinfosbyname
041_Record Type的更多相关文章
- salesforce 零基础学习(六十二)获取sObject中类型为Picklist的field values(含record type)
本篇引用以下三个链接: http://www.tgerm.com/2012/01/recordtype-specific-picklist-values.html?m=1 https://github ...
- AutoMapper:Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 应用场景:ViewModel==>Mode映射的时候出错 AutoMappe ...
- $.type 怎么精确判断对象类型的 --(源码学习2)
目标: var a = [1,2,3]; console.log(typeof a); //->object console.log($.type(a)); //->ar ...
- input type='file'上传控件假样式
采用bootstrap框架样式 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> &l ...
- mount报错: you must specify the filesystem type
在linux mount /dev/vdb 到 /home 分区时报错: # mount /dev/vdb /homemount: you must specify the filesystem ty ...
- error C4430:missing type specifier 解决错误
错误 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ...
- The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files
看到了http://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-clas ...
- OpenCASCADE Ring Type Spring Modeling
OpenCASCADE Ring Type Spring Modeling eryar@163.com Abstract. The general method to directly create ...
- <input type="file">上传文件并添加路径到数据库
注:这里是用的mvc所以没法用控件 html代码 <form method="post" enctype="multipart/form-data"> ...
- html中,文件上传时使用的<input type="file">的样式自定义
Web页面中,在需要上传文件时基本都会用到<input type="file">元素,它的默认样式: chrome下: IE下: 不管是上面哪种,样式都比较简单,和很多 ...
随机推荐
- MobaXterm汉化版教程
MobaXterm中文版是一款非常好用的远程连接.远程控制软件,它堪称全能终端神器,支持非常多的远程协议 ,如SSH,Telnet,Rsh,Xdmc,RDP,VNC,FTP,SFTP,串口(Seria ...
- springboot docker打包镜像
首先在idea中创建springboot项目,pom文件packaging 为jar ,然后编写接口. 编写Dockerfile 注意Dockerfile只能这样命名. 使用maven打包命令或者使用 ...
- vue学习之-----组件递归调用
1.关键点 2.父组件 <template> <div> <div class="btn-title"> <el-button @clic ...
- 《Makefile中DEP_LIBRARIES变量的作用》
1.例子 DEP_LIBRARIES := lib@InfoSDK_api lib@WMTMedia lib@WMTUtil lib@curl 该变量是Makefile里面内置的变量,作用是指定依赖的 ...
- [转]C#的反射
一.反射简介 1.1.反射的说明 反射:指程序可以访问.检测和修改它本身状态或行为的一种能力(即:审查元数据并收集关于它的类型信息的能力). ①元数据(编译以后的最基本数据单元:指程序和程序类型本身的 ...
- 事务与spring事务
事务 事务的特性(ACID) 原子性(Atomicity): 标识将事务中所有的操作进行捆绑层一个不可分割的单元格,计对事务所有进行的数据库修改等操作,要么全部执行,要么就是全部失败隔离性(Isola ...
- Oracle函数NULLIF
1.NULLIF函数 函数语法:NULLIF(Expression1,Expression2) 函数功能:如果来个表达式相等,则返回NULL值,否则返回第一个表达式 功能很简单,但是要注意以下几种情况 ...
- vue请求插件axios响应拦截302
axios.interceptors.response.use(function (response) { return response;}, function (error) { // 对请求错误 ...
- (转) IIS隐藏响应头信息
先安装url-rewrite组件 http://www.iis.net/downloads/microsoft/url-rewrite 修改应用根目录下的Web.config配置文件 <conf ...
- 蓝桥杯训练赛二-2021 问题 G: 坐标排序
题目描述 请将坐标x,y,z依照以下规则排序: x为第一关键字,当x相同时,依照y(第二关键字)大小来排序,当y相同时,依照z大小来排序(第三关键字) 给出了若干坐标,和一个数k,请输出按关键字排序第 ...