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下: 不管是上面哪种,样式都比较简单,和很多 ...
随机推荐
- angular 路由守卫Observable异步请求串联
假设路由守卫有这种场景 需要使用observable同时发送多个Http 请求,判断request2返回的数据中是否存在request1返回的数据 使用async await export class ...
- VS2022在打开设计器的时候提示某变量未声明或者未赋值
有可能是在属性中直接添加引用的dll文件,导致dll并不能被该文件稳定引用,可以删除引用,重新添加试试
- js判断图片链接是否有效
let checkImgExists = function(url) { return new Promise(function(resolve, reject) { let ImgObj = new ...
- react 二级路由嵌套
嵌套路由之后,静态文静路径错误, 更改webpack 打包output 输出根目录,publicPath:'/',二级路由刷新之后白屏,在首页模板文件中路径前加 /,
- Excel VBA实例
有个朋友让帮忙看下excel数据怎么处理,初步一看有点复杂,难以下手.进一步分析.搜索,发现VBA可以很好地解决这个问题,总结记录一下. 问题描述:如下图,有N个sheet,每个sheet记录了一个公 ...
- shell 脚本请求接口报错
2023-01-18 22:07:07.984 WARN 11700 --- [io-9044-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : ...
- clear
BFC虽然可以达到外部背景由内部内容撑开的效果,但是存在副作用 所以由clear将affter受浮动效果解除,来解决以上问题
- 小白之Linux基础命令
命令大全 : http://man.linuxde.net/touch --------------------------20170802晚linux ls--显示当前路径下的文件及文件夹名字cd ...
- ref(代替id)
App.vue <template> <div> <Student ref="str"/> <h3 v-text="age&qu ...
- C++ 17 遍历文件夹图片文件进行循环操作
#include <filesystem>using namespace std;namespace fs = std::filesystem; string path = filepat ...