057_Apex 开发中的问题
2019/12/27
补充内容:
1. %2F 由于页面的按钮点击或者Detail 页面编辑url中会生成 returnURL=%2F id,需要注意下
2. Trigger 中, __r 与触发条件无关的表,如lookup的字段需要再次去查询下
for (object aa : triggerNew) {
pIds.add(aa.id);
}
然后用这个pids作为参数条件再次去检索【select id,__r.Name from where id in :pids】
3.date 字段format格式 转成String
aa = Datetime.newInstance(pp.Start_Date__c, Time.newInstance(0,0,0,0)).format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'');
System.debug('*************************:'+aa);
1.Apex 代码中出现空白格,可以使用%20 来代替
https://answers.yahoo.com/question/index?qid=20081125224230AAAsZHB
2. Formula :Field(Type = num,小数点两位) (EndTime-StartTime )得到的结果为天 ,可以*24 得到小时
User currentUser = [SELECT Id, Profile.Name,UserRole.Name FROM User WHERE Id = :UserInfo.getUserId()]; (String.isNotBlank(currentUser.UserRole.Name) && currentUser.UserRole.Name.contains('***')) ? true : false;
3.Error :
Illegal assignment from LIST<Account> to LIST<Account> at line in Apex Class
因为Class有一个名字为Account的类,在代码中 List<Account> 中的Account 无法辨识Account是Object 还是一个Class。
4. 在标准对象中,创建了一个ID 那么它对应的APIname 就是ID__c ,执行一段js脚本,其中使用了{!Account.Id}来获得当前记录的Id。
那么 当ID这个字段没有赋值的情况下,获取的对应Account的ID;
若给这个ID赋值的情况下,获取到的就是这个ID的值。
综上所述3、4,建议不要创建与Object 相同的Class 名,同样也不要创建一个已经存在的Field Name。
5.
15. What is External id?primary id?
External id is unique to external application.
Primay id is unique to internal organization.
21.Auto-response rules and Escalation rules(for which objects are mandatory)?
Case and Lead.
27. What is Inline visualforce page?
Having vf page in pagelayout.
32. In a visual force page the save should ensure the data to be be stored in current object as well as associated child object?
We have to use Database.SavePoint and Database.Rollback for this
situation.
38. What is the Difference between Ajax and Action Poller?
ActionPolleris a timer that sends an AJAX update request to the server
according to a time interval that you specify.
41.I have added an string 'updated' to all users in Account object through batch apex,now how to remove that 'updated'?
Run the below code in developer console
List<Account> acc =[SELECT Id, Name FROM Account];
for(Account a : acc)
{
a.Name = a.Name.removeEnd('Updated');
update a;
}
45. Can you give me situation where we can you workflow rather than trigger and vice versa?
If you want to perform any action after some action, we can go for
Workflow Rule.
If you want to perform any action before and after some action, we can
go for Trigger.
48. What is the difference between trigger.new and trigger.newmap?
Trigger.new can be used in before and after operations.
Trigger.newMap can be used in after insert and after and before update.
56. Can you tell the
difference between Profile and Roles?
Profiles are used for Object level access settings.
Roles are used for Record level access settings.
57. What are permission
sets?
Permission Sets are used to extend Profile permissions.
72. What is meant by
Rendered & Re-render attribute in VF?
Rendered is used decide whether to display or hide the VF elements.
Re-Render is used to refresh the VF elements.
3) If in your organisation Person Account feature is enabled.Whenever your converting the Lead how you will decide which Account(Business or Person) to be created?
Ans : Based on the company field value on Lead we will decide whether to
create Business Account or Person Account.If Company field
value in Lead object is blank then we will create Person account on it's conversion and If Company Field value on Lead object is not blank we will create
Business Account
56. Can you tell the
difference between Profile and Roles?
Profiles are used for Object level access settings.
Roles are used for Record level access settings.
69) What is bucket field in Salesforce? Report
67) What is mean by Junction Object? //http://www.jitendrazaa.com/blog/salesforce/deep-drive-in-junction-object-create-many-to-many-relationship-in-salesforce/
17) What will happens to Junction Object If I delete Primary Object?
18) What will happen to Junction Record If I delete any one M-D record?
19) How you will create One-to-One relationship in Salesforce?
Create a custom field on the Contact object. Make the field unique. This field would be used to hold the ID of the associated Account.
Step 2:
Create a Workflow rule on Contact. Update the custom field with the value of the associated Account ID.
Done!! you have established a one to one relationship between Account and Contacts...
When you try to add a second contact to the Account, the "unique" constraint would be violated and an error would be thrown....
update record cross object
// Query for the contact, which has been associated with an account.
Contact queriedContact = [SELECT Account.Name
FROM Contact
WHERE FirstName = 'Mario' AND LastName='Ruiz'
LIMIT 1];
// Update the contact's phone number
queriedContact.Phone = '(415)555-1213';
// Update the related account industry
queriedContact.Account.Industry = 'Technology';
// Make two separate calls
// 1. This call is to update the contact's phone.
update queriedContact;
// 2. This call is to update the related account's Industry field.
update queriedContact.Account;
【upsert用法】
Contact jane = new Contact(FirstName='Jane',
LastName='Smith',
Email='jane.smith@example.com',
Description='Contact of the day');
insert jane;
// 1. Upsert using an idLookup field
// Create a second sObject variable.
// This variable doesn’t have any ID set.
Contact jane2 = new Contact(FirstName='Jane',
LastName='Smith',
Email='jane.smith@example.com',
Description='Prefers to be contacted by email.');
// Upsert the contact by using the idLookup field for matching.
upsert jane2 Contact.fields.Email;
// Verify that the contact has been updated
System.assertEquals('Prefers to be contacted by email.',
[SELECT Description FROM Contact WHERE Id=:jane.Id].Description);
custome setting:
White_List_Setting__c whiteListSetting = White_List_Setting__c.getInstance(UserInfo.getUserId());
2021.8.31
1. Schedule apex Set Batch 问题:You have to go to Develop-> Apex Classes and click on Compile all classes, then click on Schedule Apex and you will be able to schedule the job.
2. 获取系统最高权限: SELECT Id,name FROM Profile WHERE PermissionsModifyAllData= TRUE
057_Apex 开发中的问题的更多相关文章
- TDD在Unity3D游戏项目开发中的实践
0x00 前言 关于TDD测试驱动开发的文章已经有很多了,但是在游戏开发尤其是使用Unity3D开发游戏时,却听不到特别多关于TDD的声音.那么本文就来简单聊一聊TDD如何在U3D项目中使用以及如何使 ...
- React在开发中的常用结构以及功能详解
一.React什么算法,什么虚拟DOM,什么核心内容网上一大堆,请自行google. 但是能把算法说清楚,虚拟DOM说清楚的聊聊无几.对开发又没卵用,还不如来点干货看看咋用. 二.结构如下: impo ...
- Android学习探索之Java 8 在Android 开发中的应用
前言: Java 8推出已经将近2年多了,引入很多革命性变化,加入了函数式编程的特征,使基于行为的编程成为可能,同时减化了各种设计模式的实现方式,是Java有史以来最重要的更新.但是Android上, ...
- Java开发中的23种设计模式详解
[放弃了原文访问者模式的Demo,自己写了一个新使用场景的Demo,加上了自己的理解] [源码地址:https://github.com/leon66666/DesignPattern] 一.设计模式 ...
- 总结iOS开发中的断点续传那些事儿
前言 断点续传概述 断点续传就是从文件赏赐中断的地方重新开始下载或者上传数据,而不是从头文件开始.当下载大文件的时候,如果没有实现断点续传功能,那么每次出现异常或者用户主动的暂停,都会从头下载,这样很 ...
- 【初码干货】使用阿里云对Web开发中的资源文件进行CDN加速的深入研究和实践
提示:阅读本文需提前了解的相关知识 1.阿里云(https://www.aliyun.com) 2.阿里云CDN(https://www.aliyun.com/product/cdn) 3.阿里云OS ...
- C#开发中使用配置文件对象简化配置的本地保存
C#开发中使用配置文件对象简化配置的本地保存 0x00 起因 程序的核心是数据和逻辑,开发过程中免不了要对操作的数据进行设置,而有些数据在程序执行过程中被用户或程序做出的修改是应该保存下来的,这样程序 ...
- iOS开发中静态库之".framework静态库"的制作及使用篇
iOS开发中静态库之".framework静态库"的制作及使用篇 .framework静态库支持OC和swift .a静态库如何制作可参照上一篇: iOS开发中静态库之" ...
- iOS开发中静态库制作 之.a静态库制作及使用篇
iOS开发中静态库之".a静态库"的制作及使用篇 一.库的简介 1.什么是库? 库是程序代码的集合,是共享程序代码的一种方式 2.库的类型? 根据源代码的公开情况,库可以分为2种类 ...
- Java开发中的23种设计模式详解(转)
设计模式(Design Patterns) ——可复用面向对象软件的基础 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结.使用设计模式是为了 ...
随机推荐
- 简单的自动清理TIM/QQ聊天垃圾文件方案
我平时喜欢在后台挂着Tim,时间一长,我发现数据文件夹会越来越大,即使我没有看过这些消息(多为群聊消息),为了不再惦记清理垃圾文件,我整理了以下方案,可以每天清理一次7天前的文件. 1. 在磁盘任意位 ...
- go1.8-泛型
基本思想: Parametric Polymorphism(形式)参数多态 基本语法 package main import "fmt" func printSlice[T any ...
- my.ini
[client] #客户端设置,即客户端默认的连接参数 # socket = /data/mysqldata/3306/mysql.sock #用于本地连接的socket套接字 # 默认连接端口 po ...
- java spring 理解
1.spring IOC容器 其实就是 new 了一个 ApplicationContext 类对象.->应用上下文对象. 2.应用上下文对象 实例化.配置,并管理 bean. 所以上下文对象是 ...
- 软件开发流程-路飞项目需求- pip永久换源-虚拟环境-路飞项目前后端创建-包导入-后端项目调整目录
目录 软件开发流程-路飞项目需求- pip永久换源-虚拟环境-路飞项目前后端创建-包导入-后端项目调整目录 今日内容概要 今日内容详细 1 软件开发流程 2 路飞项目需求 3 pip永久换源 4 虚拟 ...
- 路飞项目day01 软件开发流程、PIP永久换源、虚拟环境、路飞项目开始
一.软件开发流程(重要) 我们作为一个后端,虽然一般情况下只专注自己的那一部分事情,但是有时候小公司,人员架构没那么细化,或者老板就是想省钱少招点人,我们就得大致熟悉软件开发流程,知道上司.其他同 ...
- reduce对数组及数组对象的常见操作
语法: array.reduce(function(prev, currentValue, currentIndex, arr), initialValue)prev: 初始值,或者是计算结束后的返回 ...
- SwiftUI笔记
@Published 标记对象定义的属性变更可以被监听,当对应字段变化时会触发对象 objectWillChange 通知,订阅了该属性的View也会收到值改变的通知 /// A type that ...
- AXI VALID READY 握手机制
1. VAILD 和READY 传输方向 2. VAILD 和READY依赖关系 前面说到AXI的五个通道是独立的,但通道间必须保持一定的约定关系:写回复必须在一次写事务的最后一个写数据之后读数据必须 ...
- 【已解决】SpringBoot + Mybatis-plus 实体类属性注解 @TableField 无法获取到数据库值(属性变量名带下划线)
问题描述: 实体类变量的命名格式 如果采用的是 XX_XX带下划线的形式,那么在低版本的mybatis-plus是不支持和数据库映射的. 如果是单个单词不存在这个问题,如果出现多个单词,尽量采用驼峰式 ...