Monday 16 December 2013

Winter- 14 Maintenance Exam Test Questions

Options may vary in exam

So also refer Winter 14 release notes
Winter 14 Release notes
What is a capability of Collaborative Forecasts?

A. View the forecast separately for each product family
B. Reflect split revenue amounts in the forecast.
C. Display the forecast by territory when using territorry management
D. View the forecast for specific periods in a custom fiscval year.
Answers
A,B

What is a capability of embedded analytics?

A. Reports charts can be used to show data from tabular, summary and joined reports.
B. An embedded chart can be filtered to show data for the record on which it appears.
C. Report charts can be embedded on page layouts for standard and custom objects
D. An embedded chart can be used to share report data from a personnal folder
Answers
B,C

What is a capability of Salesforce Identity

A. Require users to have a HighAssurance session to edit, modify or delete selected objects
B. Require users to have a High Assurance session to access Reports, Dashboards, and connected Apps
C. Require users to use a time-based token when logging into Salesforce outside the trusted IP ranges.
D. Require users to enter a time-based token in addition to login credentials when accessing Salesforce
Answers
B,D

What is a capability of chatter Answers
Chosse 2 answers

A. Users can save drafts of questions an answers to be posted later.
B. Users can post private replies to an Idea on the Ideas tab
C.Users can reply to a question directly from an email notification
D. Users can view Questions and Ideas activity on Chatter profiles
Answers
C,D

How can an administrator customize Live Agent

A. Add images, animations, and custom agent
B. Add pre-recorded voice greetings and music to chat invitations.
C. Configure automated chat invitations to route chats to agents with specific skills
D. Configure agent settings to accept chats from the Q&A tab.
Answers
A,C

How can the Salesforce Console for Sales be customized?

A. Developpers can create custom console components to display sales information.
B. Sales reps can create personal customizations to override which tabs are subtabs.
C. Administrators can add custom buttons to the navigation tab and the highlights panel.
D. Administrators can define primary tabs and subtabs to show related records on one screen.
Answers
C,D

How can an administrator or developper restrict users from seeing other users in the organization?

A. Set the OWD for the User object to private
B. Enable the "Restrict Access to users" permission for all users
C. Disable manual sharing for the User object
D. Create a sharing rule to prevent users from seeing other users.
Answers
A

What is a capability of historical trending?

A. Hitorical trending reports can be filtered to show only records that have changed.
B. Hitorical trending can track number, formula and checkbox fields.
C. Hitorical trending reports show changed values in different colors
D. Hitorical trending can be enabled for all standard and custom objects.
Answers
A,C

What is a true statement regarding Salesforce Knowledge

A. Users can search and view articles without a knowledge User licence
B. Users can create and publish articles without the Manage Articles permission.
C. Users can provide feedback on the Chatter feed of a draft article.
D. Users can add and remove suppported languages in the knowledge base
Answers
A,C

What is a capability of Entitlement Management?

A. Create recurring milestone within an entitlement process.
B. Execute a flow when a milestone is met or violated.
C. Define criteria-based sharing rules for an entitlement process.
D.View the countdown tme to an activ milestone's Target Date.
Answers
A,D

How can an administrator customize Salesforce Console?

A. Add the Home tab to the navigation tab.
B. Add related lists to the Interaction log Layout.
C. Add the Most Recent Tabs component to the footer.
D. Add a dashboard component to the HighlightsPanel.
Answers
A,C

What is the capability of Site.com ?
Answers
A. Multilingual Language Support
B.HTML page imports are supported
C.Creating Preview oages, templates for different platforms using Live Mode

Thursday 5 December 2013

Get fields of sobject in picklist of visualforce

 //Apex class  
 public string fields{set;get;}  
 Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();  
 //method for fields retrival and storage in picklist  
 public list<selectoption> getFields(){  
   String type='Account';  
   List<SelectOption> options = new List<SelectOption>();  
    //Creating sObject for dynamic selected object  
       Schema.SObjectType systemObjectType = gd.get(type);  
       //Fetching field results  
       Schema.DescribeSObjectResult r = systemObjectType.getDescribe();  
        Map<String, Schema.SObjectField> M = r.fields.getMap();  
       //Code for picklist of fields in  
       options.add(new SelectOption('None' ,'--None--')) ;  
       for(Schema.SObjectField fieldAPI : M.values()){  
       options.add(new SelectOption(fieldAPI.getDescribe().getName() ,       fieldAPI.getDescribe().getLabel())) ;  
       }  
       return options;  
     }//end of code for retrieving fields dynamically  
//vf page
 
  <apex:selectList value="{!Field}" size="1">  
    <apex:selectOptions value="{!Fields}">  
    </apex:selectOptions>  
  </apex:selectList>  

Thursday 7 November 2013

PAGEBLOCKTABLE EDIT/DELETE FUNCTIONALITY

A basic example to edit/delete records individually.
Here i have taken two pages editdelete and editfun
on clicking edit in page 1 i am redirected to page 2 to edit the record and save it, after saving i am redirected to sobject detail page.
Below is code for page 1 :-

 <apex:page showHeader="false" sidebar="false" controller="editcon" tabStyle="Acc__c">  
 <apex:form >  
 <apex:sectionHeader title="edit/delete"/>  
 <apex:pageBlock >  
 <apex:pageBlockTable value="{!stun}" var="stu">  
 <apex:column >  
 <apex:param name="sid" value="{!stu.id}"/>  
 </apex:column>  
 <apex:column value="{!stu.name}"/>  
 <apex:column value="{!stu.Name__c}"/>  
 <apex:column value="{!stu.Age__c}"/>  
 <apex:column value="{!stu.Gender__c}"/>  
 <apex:column headerValue="Action">  
 <apex:commandLink value="EDIT" action="{!edit}">  
 <apex:param name="cid" value="{!stu.id}" assignTo="{!ecid}"/>  
 </apex:commandLink>  
 &nbsp;&nbsp;&nbsp;&nbsp;  
 <apex:commandLink value="DELETE" action="{!deletecon}">  
 <apex:param name="cid" value="{!stu.id}" assignTo="{!dcid}"/>  
 </apex:commandLink>  
 </apex:column>  
 </apex:pageBlockTable>  
 </apex:pageBlock>  
 </apex:form>   
 </apex:page>  
page 1 screen shot:-

controller class:-
 public class editcon {  
 list<Acc__c> stun = new list<Acc__c>();  
 list<Acc__c> stun1 = new list<Acc__c>();   
 public string ecid{get;set;}  
 public string dcid{get;set;}  
   public PageReference deletecon() {  
   stun1 =[Select Name, name__c, age__c from Acc__c where id=:dcid];  
     delete stun1;  
     pagereference pg= new pagereference('/apex/editdelete');  
     pg.setRedirect(True);      
     return pg;  
   }  
  public PageReference edit() {  
   pageReference pg = new pagereference('/apex/editfun?id='+ecid);  
   pg.setRedirect(false);  
     return pg;  
   }  
  public list<Acc__c> getStun() {  
   stun = [select name, name__c, age__c,gender__c from Acc__c];  
     return stun;  
   }  
 }  
}


page  2:-
 <apex:page showHeader="false" sidebar="false" standardController="Acc__c"tabstyle="Acc__c">  
 <apex:form >  
 <apex:sectionHeader title="Edit the record"/>  
 <apex:pageBlock tabStyle="Acc__c">  
 <apex:pageBlockButtons location="both">  
 <apex:commandButton value="save" action="{!save}"/>  
 </apex:pageBlockButtons>  
 <apex:pageBlockSection >  
 <apex:inputField value="{!Acc__c.Name__c}"/>  
 <apex:inputField value="{!Acc__c.Age__c}"/>  
 </apex:pageBlockSection>  
 </apex:pageBlock>  
 </apex:form>  
 </apex:page>  
screen shot of page 2:-

Monday 4 November 2013

Example to Display Page block Table on button click

<apex:page controller="showpgbtable" >
 <apex:form >
  <apex:commandButton value="showtable" action="{!accountlist}" reRender="panel"/>
   <apex:outputPanel id="panel" >
    <apex:pageBlock rendered="{!rendered}" >
     <apex:pageBlockTable value="{!accounts}" var="a" >
      <apex:column value="{!a.name}"/>
     </apex:pageBlockTable>
    </apex:pageBlock>
   </apex:outputPanel>
 </apex:form>
</apex:page>

//controller class
public class showpgbtable {
 public list<Account> acc1 = new list<account>();
public Boolean rendered{set;get;}
public showpgbtable(){ //constructor
rendered =false;
}
 public pageReference Accountlist(){
    acc1 = [select id,name from account ];
     rendered  = true;
    return null;
   }
   public list<account> getaccounts(){
   return acc1;
   }
Screen Shots:-

}

Sunday 3 November 2013

UPLOADING IMAGE IN SALESFORCE THROUGH VF PAGE

A very common requirement we come across is uploading image/photo through vf pages. While doing this task we need to keep in mind that we can't directly display image in visualforce page in salesforce. It should be stored at some place- There are 3 places where we can store our images

  1. Documents
  2. Static Resources
  3. Attachments.
Below i am illustrating an example of uploading and displaying image in visualforce using Documents sobject.


<!--vf page code-->
 <apex:pageBlockSection title="Upload Photo" collapsible="false" columns="1" >  
 <apex:image url="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!doc}" height="100"       width="100" rendered="{!showimage}" /> /*contains the url of documents,{!doc} gives the image dynamically */  
  <apex:inputFile value="{!Document.body}" filename="{!document.name}" />  
 <center><apex:commandButton value="Upload" action="{!save}" /></center>  
  </apex:pageBlockSection>  
//apex class code
 public boolean showimage{set;get;}  
  public final document t;  
   private ApexPages.StandardController stdcontroller;  
   public getdocumentid(ApexPages.StandardController stdcontroller) {  
   t = (Document) stdcontroller.getRecord();  
     t.folderid = UserInfo.getUserId(); //this saves record in My Personal Documents  
     this.stdcontroller=stdcontroller;  
     }    
  public pagereference save(){  
   this.stdcontroller.save();// this method implements the standard save method.  
   pagereference pg=new pagereference('/apex/vfpageimageupload');  
   showimage=true;  
   return pg;  
   }   
   List<document> d;  
   public id doc{set;}  
   public id getdoc()  
   {  
   d=[select id from document order by id desc limit 1]; //gets id of document inserted last in sobject  
   return d[0].id;// returns id value of list d  
   }   

Monday 28 October 2013

selected record popup using radiobutton in salesforce

Radio buttons, We have a great usage of this to select or deselect records. Recently did this task and found it would be useful for some newbies.. I think the code is self explanatory

<!-- My Page-->

 <apex:page Controller="AccountTaskClass7" sidebar="false">  
  <style type="text/css">  
  .popup  
  {  
  background-color: pink;  
  border-width: 2px;  
  border-style: solid;  
  z-index: 9999;  
  left: 50%;  
  padding:10px;  
  position: absolute;  
  width: 400px;  
  margin-left: -250px;  
  top:80px;  
  }  
  .popupBg  
  {  
  background-color:yellow;  
  opacity: 0.20;  
  filter: alpha(opacity = 70);  
  position: absolute;  
  width: 100%;  
  height: 100%;  
  top: 0;  
  left: 0;  
  z-index: 9998;  
  }  
  </style>  
  <apex:form id="form">  
  <apex:pageblock id="pb">   
  <apex:pageBlockTable id="pbt" value="{!getAcountt}" var="act">  
  <apex:column headerValue="Account Name">  
  <apex:outputText value="{!act.name}"></apex:outputText>  
  </apex:column>  
  <apex:column headerValue="Detail">  
  <apex:outputPanel >  
  <apex:actionSupport event="onclick" action="{!detailPage}" rerender="popup,pb">  
  <input type="radio" name="det" />  
  <apex:param value="{!act.id}" assignTo="{!id}" name="id"/>  
  </apex:actionSupport>  
  </apex:outputPanel>  
  </apex:column>  
  </apex:pageBlockTable>  
 </apex:pageblock>  
 <!--popup code starts-->  
  <apex:outputPanel id="popup">  
  <apex:outputPanel styleClass="popupBg" layout="block" rendered="{!displayPopUp}"/>  
  <apex:outputPanel styleClass="popup" layout="block" rendered="{!displayPopUp}">  
  <apex:messages />  
  <center><h2>{!act_name} Account Information</h2></center>  
  <apex:panelGrid columns="2" >  
  <apex:outputLabel value="Account Name"/><apex:outputText value="{!act_name}" />  
  <apex:outputLabel value="Number of Employee"/><apex:outputText value="{!act_noe}" />  
  <apex:outputLabel value="Industry"/><apex:outputText value="{!act_ind}" />  
  <apex:outputLabel value="Annual Revenue"/><apex:outputText value="{!act_annual_rev}" />  
  <apex:commandButton value="cancel" action="{!closePopup}" rerender="popup,pb"/>  
  </apex:panelGrid>  
  </apex:outputPanel>  
  </apex:outputPanel>  
 <!-- end of popup code-->  
  </apex:form>  
 </apex:page>  

//controller class
 public with sharing class AccountTaskClass7 {  
  public decimal act_annual_rev { get; set; }  
  public String act_ind { get; set; }  
  public String act_name { get; set; }  
  public integer act_noe { get; set; }  
  public boolean displayPopUp { get; set; }  
  public String acct { get; set; }  
  public PageReference showPopup() {//popupmethod  
  displayPopup = true;  
  return null;  
  }  
 public PageReference closePopup() {//hide method  
  displayPopup = false;  
  return null;  
  }  
 public PageReference detailPage() {// action method which shows popup on selection  
  displayPopup = true;  
  system.debug('Select Item Id is ::: '+ApexPages.currentPage().getParameters().get('id'));  
  String id = ApexPages.currentPage().getParameters().get('id');  
  account ac = [select id,name,NumberOfEmployees,Industry,AnnualRevenue from account where id  
 =: id];  
  act_name = ac.name;  
  act_noe = ac.NumberOfEmployees;  
  act_ind = ac.Industry;  
  act_annual_rev = ac.AnnualRevenue;  
  return null;  
  }  
  public list<account> getGetAcountt() {  
  list<account> act_name = [select id,name from account];  
  return act_name;  
  }  
 }  
}


Screen shots:-

Monday 13 May 2013

Simple Search


VF Code:
 <apex:page sidebar="false" showHeader="false" controller="ser" tabstyle="account">  
 <apex:form >  
 <apex:pageBlock >  
 <apex:panelGrid title="search your query">  
 <apex:outputText >Book name</apex:outputText>  
 <apex:inputText value="{!accname}"/>  
 <apex:commandButton value="Search" action="{!search}"/>  
 <apex:pageBlockTable value="{!accname1}" var="b">  
 <apex:column value="{!b.id}"/>  
 <apex:column value="{!b.name}"/>   
 </apex:pageBlockTable>  
 </apex:panelGrid>  
 </apex:pageBlock>  
 </apex:form>  
 </apex:page>  

Apex Class Code:
 public class ser {  
 public string accname{set;get;}  
 public string item{set;get;}  
 public string accname1{set;}  
 account bk = new account();  
 public pagereference search(){  
 bk = [select id,name from account where name = : accname];  
 return null;  
 }  
 public account getaccname1(){  
 return bk;  
 }  
 }