What is property in Apex? – Salesforce

Property in Apex

What is property in Apex? Apex mainly consists of the syntax from the well-known programming language Java.As a practice of encapsulation in java we declare any variable as private and then create the setters and getters for that variable.

Private String name;
Public void setName(String n)
Public String getName()
Return name;

However, the Apex introduced the new concept of property from language C# as shown below:
publicString name {get; set;}
It has another advantage in “number of lines of code” limit by salesforce which will drastically reduced.

Interview questions on visualforce pages – 2

Interview questions on visualforce pages – 2

11. What is <apex:form> tag?

<Apex:form> tag allow a section of a visualforce page to enter input values & Buttons to submit it. The body of the form tag contains, how data is placed & how it is process. The best practice is to use only one form tag in page.

12. What is <apex:pageBlock> tag?

<Apex:pageBlock> helps you to provide standard salesforce detail page look and feel in your visual force pages without any default content.

13.What is <apex:pageBlockSection> tag?

<apex:pageBlockSection> tag represents a section of data with in an <apex:pageBlock> component, which is similar to a section in a standard salesforce page layout. In page block section we can define number of columns required to display in a single page. This component must be a child <apex:pageBlock>

14. What is <apex:pageBlockButtons>?

<apex:pageBlockButtons> tag is used to display buttons & links in salesforce standard format. This tag must be a child of <apex:pageBlock>

15. Can we define <apex:pageBlockButtons> under <apex:pageBlockSection> tag?

No, <apex:pageBlockButtons> must be direct child of <apex:pageBlock> tag.

Visualforce page to explain about tags mentioned in above questions.

<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            <apex:pageBlockSection title="My Content Section" columns="2">           
                <apex:inputField value="{!account.name}"/>                
                <apex:inputField value="{!account.type}"/>                

 This code displays a small form to enter account name & type. See the below screen to see the output of above code.

Interview questions on visualforce pages - 2

Password polices at profile level

Now you can manage password policies at profile level in salesforce

In winter’15 release salesforce has provided this feature to mange password policies like password expire in, history, length, complexity requirement, maximum invalid login attempts and lockout effective period at profile level. Earlier this option is available at organization level. Now with this winter’15 release this option is available at profile level also.

Until you set the password policies on profile, the organization policies will apply to users. Once you set the password policies at profile level, it will override organization changes. After setting password policies at profile level, if you change these settings at org – level, it won’t impact. profile settings will only apply when set these settings at profile level.

How we can set this at organization level

To find these settings at organization level, go to Settings -> Administer -> Under security controls you will find this option. see the below screen to understand.

password policies How can set this at profile level:

To find these settings at profile level, go to settings -> Administer -> Manage users -> profiles -> Select the profile you want to change and edit the profile to change these settings. see the below screen for reference.

password policies

 This option is available in Enterprise, performance, Unlimited and Developer editions. Need below User permissions required to edit session & password settings in profiles.

Manage permission sets & PROFILES and manage password policies.