057_Apex 开发中的问题

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?

Step 1:

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());

 

 
 

 

 

转载于:https://www.cnblogs.com/bandariFang/p/9237554.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值