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下: 不管是上面哪种,样式都比较简单,和很多 ...
随机推荐
- Esp8266 Arduino PubSubClient连接阿里云老是返回rc=2错误的解决方案
最近在用Esp8266 Arduino连接阿里云IOT的时候,服务器端老是返回rc=2 的错误! 用了MQTTfx模拟连接阿里云IOT没有问题,但是把同样的ClientID,UserName和Pass ...
- Hadoop环境的搭建
Hadoop HDFS.Yarn.MapReduce Hadoop集群环境搭建 完全分布式环境,伪分布式将其中的多台服务器改为一台,并将配置文件中的相关内容更改即可 1.安装Linux系统模型机 关闭 ...
- Python的入门学习之Day 9——from“夜曲编程”
Day 9 time: 2021.8.6. 昨天复习了第一章"数据与运算".第二章"条件判断"的相关重点,今天就感觉得心应手了.今天上新的内容是关于新一章节&q ...
- flutter Slivers
一. Slivers 我们考虑一个这样的布局:一个滑动的视图中包括一个标题视图(HeaderView),一个列表视图(ListView),一个网格视图(GridView). 我们怎么可以让它们做到统一 ...
- jboss单机环境搭建
1.操作系统:centos7 2.需要的包:apache,wildfly,postgres(要初始化),activemq 3.安装流程: 一.安装依赖包并部署服务:httpd,wildfly,mq,p ...
- vue资料链接
vue 官方api:https://cn.vuejs.org/ vue资源精选:http://vue.awesometiny.com/ vue GitHub地址:https://github.com/ ...
- shell脚本,shell语法和结构(以Cshell/TC shell为例)
1.C shell/TC shell常用语法和结构 (1) shbang行: #!/bin/sh,通知内核使用哪种内核解释脚本; #!/bin/csh 或 #!/bin/tcsh (2) 注释: 以# ...
- sublime4 支持中文
sublime_text_build_4143_x64_setup 安装完毕后,工具,命令面板,install package,ChineseLocalizations
- https原理(七)其他
1 fiddler原理+fiddler为什么抓chrome而不能抓curl和httpclient?fiddler为什么能篡改报文? 中的ssl pinning 本质即是双向ssl https://zh ...
- PMP项目启动会与开工会议
转载https://www.cnblogs.com/yanpeng1991/p/11391805.html 项目启动会(project initiating meeting)与项目开工会(kick-o ...