Monday, April 6, 2015

Basic Salesforce Interview questions part 6

67. Can you use dml statement in visualforce compoenent controller ?
Ans: To use dml in visualforce component you have to declare allowdml=true in visualforce component otherwise you will get an exception
     "DML is currently not allowed"
 
68. Can you write sosl in trigger>?
Ans: Earlier this was not allowed but now sosl are allowed in triggers.

69. Which are the different access modifiers in apex?
Ans: 1. Private 2. Public 3. Protected 4.Global are the four access modifiers allowed in apex

70. Can you change the master of a detail record in salesforce ?
Ans. Yes provided you have ticked marked "Allow reparenting" in field setting otherwise the field is read only and master cannot be changed.

71. How can you lock records in apex?
Ans: use For update in query to lock the record. For example: [select id,name from contact limit 10 For update];

72. IS there any limit on the number of items that can be stored in apex collections?
Ans: There is ni such limit but we need to consider heap size limit 6mb (6 MB as of now)

73. How can you monitor future actions of time based workflow?
Ans: setup --> administration set up --> monitoring --> time based workflow

74. What is visaulforce component ?
Ans: It is a piece of code that can be reused. It can be encapsulated in other visualforce pages.

75. Ho can you display the status of an AJAX update request in a visualforce page ?
Ans: To display AJAX request status we can use <apex:actionstatus> component.

76. How can you access custom label in apex:
Ans: Example --> string custLabelstr = System.Label.LabelNamehere

77.How can you get all the keys of a map variable ?
Ans: USe method keyset() for this
    Example = Set<id> idSet = mapname.keyset();

78. How can you compare values of a picklist field in validation rule?
Ans : for comparing picklist value use ispickval
     ISPICKVAL(picklist_field, text_to_compare)

No comments:

Post a Comment