应用场景:在使用Apex新建记录时,有时需要根据具体需求为用户匹配对应的记录类型,这个时候就需要用到记录类型Id的情况。

获取RecordTypeId的方法有2种,一种是根据soql进行查询,另一种是使用内置方法查询;

方法1:过滤的是DeveloperName

  1. Id recordTypeId = [SELECT Id, Name, DeveloperName, isActive
  2. FROM RecordType
  3. WHERE DeveloperName ='Tender_Record_Offline_Media' AND SobjectType = 'Advertiser_Tender_Relationship__c' LIMIT 1].Id

方法2:注意传入的是Label Name

  1. Id devRecordTypeId = Schema.SObjectType.ObjectName.getRecordTypeInfosByName().get('Label Name').getRecordTypeId();
  1. 如: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的更多相关文章

  1. salesforce 零基础学习(六十二)获取sObject中类型为Picklist的field values(含record type)

    本篇引用以下三个链接: http://www.tgerm.com/2012/01/recordtype-specific-picklist-values.html?m=1 https://github ...

  2. 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 ...

  3. $.type 怎么精确判断对象类型的 --(源码学习2)

    目标:  var a = [1,2,3];     console.log(typeof a); //->object     console.log($.type(a)); //->ar ...

  4. input type='file'上传控件假样式

    采用bootstrap框架样式 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> &l ...

  5. mount报错: you must specify the filesystem type

    在linux mount /dev/vdb 到 /home 分区时报错: # mount /dev/vdb /homemount: you must specify the filesystem ty ...

  6. error C4430:missing type specifier 解决错误

    错误    3    error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ...

  7. 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 ...

  8. OpenCASCADE Ring Type Spring Modeling

    OpenCASCADE Ring Type Spring Modeling eryar@163.com Abstract. The general method to directly create ...

  9. <input type="file">上传文件并添加路径到数据库

    注:这里是用的mvc所以没法用控件 html代码 <form method="post" enctype="multipart/form-data"> ...

  10. html中,文件上传时使用的<input type="file">的样式自定义

    Web页面中,在需要上传文件时基本都会用到<input type="file">元素,它的默认样式: chrome下: IE下: 不管是上面哪种,样式都比较简单,和很多 ...

随机推荐

  1. crontal 计划任务

    crontab每分钟定时执行: */1 * * * * service mysqld restart //每隔1分钟执行一次 */10 * * * * service mysqld restart / ...

  2. 菜狗记录pycharm使用问题

    1.

  3. 【SSO单点系列】(9):CAS4.0 之客户端排除不需要过滤的路径

    客户端排除不需要过滤的路径 Web.xml <filter> <filter-name>CASFilter</filter-name> <filter-cla ...

  4. VS2015+QT5.10项目中文乱码

    解决:文件-高级保存选项,选择utf-8编码.

  5. Keil5 STM32 C++开发 ARM V6编译器的使用教程

    Keil5更新之后,开始支持ARM V6编译器,新版本的编译器对C++有了更多的支持,在编译方面也做了很多的改善,具体的没有详细了解,本文只是对STM32 开发下,使用V6版本的编译器进行STM32的 ...

  6. jquery随手做的一个滚动库 我称之为 idkScroll

    /** * 仅做到底自动刷新功能 * options: { * page int 当前在第几页 * limit int 每页个数 * onBottom function 到底的回调 * whenEnd ...

  7. centos7下的防火墙部署

    iptables以及firewalld其实都是防火墙管理工具,说白一点,就是一个服务,用来保障公网与内网 iptables 由于centos7没有自带,需要自己安装 安装 yum install ip ...

  8. 基于MIPI的高性能成像系统

    硬件组件Digilent Genesys ZU × 1 (FPGA平台) Digilent PCAM5 × 1 (MIPI摄像头) 软件组件AMD-Xilinx Vivado 设计套件 介绍从简单的嵌 ...

  9. Adobe Acrobat PDF Reader DC软件下载

    安装包下载 https://get.adobe.com/en/reader/enterprise/ ftp下载,按日期排序 ftp://ftp.adobe.com/pub/adobe/reader/w ...

  10. 学习-自增id++的问题

    代码示例: let id = 0   const todos = ref([   { id: id++, text: 'Learn HTML' },   { id: id++, text: 'Lear ...