Salesforce

An effort to bring a revolution in Salesforce.

Sunday 23 August 2015

How to Set Dynamically Heder|footer in Visualforce page rander as Pdf

 Rander As Pdf Header / Footer  Visualforce  || Saleforce


<apex:page renderAs="pdf" applyBodyTag="false" standardController="Account">
<head>
    <style type="text/css" media="print">
        @page {
            @top-center {
                content: element(header);
            }
            @bottom-left {
            content: element(footer);
            }
           }
           div.header {
           padding: 10px;
           position: running(header);
           }
           div.footer {
           display: block;
           padding: 5px;
           position: running(footer);
           }
           .pagenumber:before {
           content: counter(page);
           }
           .pagecount:before {
           content: counter(pages);
           }
    </style>
</head>
           <div class="header">
              <div>Account name is: {!Account.name} }</div>
           </div>
           <div class="footer">
                <div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
          </div>
          <div class="content">
               <p>Put all the Page content in this Div Tag  </p>
          </div>
</apex:page>

Wednesday 12 August 2015

How Rendering a Visualforce page as PDF and saving it as an attachement in salesforce

How can U render a VF (Visualforce ) page as PDF and have a button on the page that saves this PDF as an attachment ?


Apex Class Code:

public class PdfRender{
    public Account acc {get;set;}
    public List<Account> ListAcc {get;set;}
   
   
    public PdfRender(){
    ListAcc = new List<Account>();
    acc = new Account();
    ListAcc =[Select Name,AccountNumber from Account Limit 10 ];
    }
   
    // return 'pdf' if the parameter 'p' has been passed to the page, or null
    public String getSelectRender() {
        if(ApexPages.currentPage().getParameters().get('p') != null)
            return 'pdf';
        else
            return null;
    }
  

    public PageReference RenderedAsPDF() {
        PageReference pdf =  Page.RenderedAsPdf;
        pdf.getParameters().put('p','p');
       

  // Below code to Save Pdf in attachment

        Blob pdf1 = pdf.getcontentAsPdf();
        Document d = new Document();
        d.FolderId = UserInfo.getUserId();
        d.Body = Pdf1;
        d.Name = 'pdf_file.pdf';
        d.ContentType = 'application/pdf';
        d.Type = 'pdf';
        insert d;
    return pdf;
    }
    }

Visualforce Page Code:

<apex:page showHeader="false"  sidebar="false" renderAs="{!SelectRender}" controller="PdfRender" >
    <apex:pageBlock title="Demo Pdf View">
    <apex:pageBlockSection > 
    <apex:pageBlockTable value="{!ListAcc}" var="ac">
                <apex:column value="{!ac.name}"/>
                 <apex:column value="{!ac.AccountNumber}"/>
            </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:form >
    <apex:commandButton action="{!RenderedAsPDF}" value="PDF View" id="theButton"/>
    </apex:form>
</apex:page>

,

How to Dynamically choosing render as PDF in Visualforce (Salesforce)

Render as PDF in Visualforce (Salesforce)

Apex Class Code :

public class PdfRender{
    public Account acc {get;set;}
    public List<Account> ListAcc {get;set;}
   
   
    public PdfRender(){
    ListAcc = new List<Account>();
    acc = new Account();
    ListAcc =[Select Name,AccountNumber from Account Limit 10 ];
    }
   
    // return 'pdf' if the parameter 'p' has been passed to the page, or null
    public String getSelectRender() {
        if(ApexPages.currentPage().getParameters().get('p') != null)
            return 'pdf';
        else
            return null;
    }
  

    public PageReference RenderedAsPDF() {
        PageReference pdf =  Page.RenderedAsPdf;
        pdf.getParameters().put('p','p');
    return pdf;
    }
    }


VF Code :

<apex:page renderAs="{!SelectRender}" controller="PdfRender" >
    <apex:pageBlock title="Demo Pdf View">
    <apex:pageBlockSection > 
    <apex:pageBlockTable value="{!ListAcc}" var="ac">
                <apex:column value="{!ac.name}"/>
                 <apex:column value="{!ac.AccountNumber}"/>
            </apex:pageBlockTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:form >
    <apex:commandButton action="{!RenderedAsPDF}" value="PDF View" id="theButton"/>
    </apex:form>
</apex:page>



,

Tuesday 11 August 2015

SFDC Adm 201 Practice Questions

SFDC Admin 201 Questions


1.A Workflow rule can only be triggered when a record is created.
A.True
B.False

2.Which of the following permissions enables the System Administrator Profile to edit any record, regardless of the Sharing Model?
A.Customize Application
B.Modify All Data
C.View Setup and Configuration
D.None of the above

3.Which of the following fields CAN NOT be a controlling field for Dependent Picklists
A.Standard Picklist
B.Custom Picklist
C.Custom Multi-Select Picklist
D.Standard Checkbox
E.Custom Checkbox

4.When you have exceeded your general storage limit, you can use your complimentary document storage for additional space.
A.True
B.False

5.To make a field required, which of the following is used) (Pick the best possible answer)
A.Page Layout
B.Field Level Security
C.Profile
D.Both Page Layout and Field Level Security

6.What type of information can NOT be shown with an S-Control Dashboard component?
A.Combination of two other Dashboard components
B.External feed of data
C.Data Warehouse information
D.Flash representations of data

7. A new list view can be created from within the console
A.True
B.False

8.All of the following are default Account record types- with Client Management EXCEPT:
A.Account Tab Default
B.Business Account Default
C.Person Account Default
D.Partner Account Default

9.You must be a user of salesforce.com in order to Receive an email notification in the case escalation process
A.True
B.False

10.If a lead is converted without a value in the company field, what happens?
A. A Business Account is created
B. A Person Account is created
C. You will be prompted to decide whether to create a Person or a Business Account
D. Nothing

11.Validation rules are also enforced using the API and Import Wizards.
A.True
B.False

12. Which of the following best describes the Opportunity Stage History related list?
A.By default the list shows ,ALL changes made on the opportunity record
B.The list tracks Stage, Amount, expected Amount, Probability, and Close Date changes
C.The list can be customized to show changes to specific fields on the opportunity
D.None of the above

13.An Approval Process begins when a record is:
A.Created
B.Saved
C.Edited
D.Submitted for Approval

14.      Time based workflow can be triggered every time a record is created Or edited
A.True
B.False

15.When you add a custom object tab, all of the following will be accessible with the object EXCEPT
A.Recent Items
B.Sidebar Search
C.Added to New Link/Create New Object Drop Down
D.Custom Object Reports

16.When you Delete a lead from a campaign, it deletes the lead record itself.
A.True
B.False

17.Which of the following can NOT be used to customize your Home Page
A.Company logo (Image)
B.Dashboard Snapshot
C.Custom Links
D.Custom Formula Field

18.All of the following objects may have a queue EXCEPT
A.Accounts
B.Cases
C.Leads
D.Custom Objects

19.What does the dashboard snapshot on the Home Page display?
A.Only the dashboard determined by the System Administrator
B.The first two rows of any of your available dashboards
C.The first row of any available dashboards
D.You cannot display a dashboard on the Home Page

20.You can use standard reports when creating Dashboards
A.True
B.False

21.Case escalation rules triggered on the last modification will be reset each time a user does which of the following actions?
A.Reads the case
B.Adds a related comment to the case
C.Adds an activity or sends an email from the case record
D.Edits the case
E.All of the above

22.Who can select the "sharing" button on Account and Opportunity records?
A.The Record Owner, System Administrator, and a User shared to the record
B.The Record Owner, a User shared to the record, and any User above the Record Owner in the Role Hierarchy
C.The Record Owner, a User above the Record Owner, and the
System Administrator
D.The Record Owner and System Administrator

23.You can report on converted leads
A.True
B.False

24.You are working with a Professional Edition organization. They wish to install the Expense Tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. If the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install Expense Tracker?
A.They will not be able to complete the installation process as they have reached the maximum number of custom tabs
B.They will not be able to complete the installation process as they have reached the maximum number of custom objects
C.The installation will succeed
D.The installation will succeed, but only the reports, dashboards and S Control will install

25.What type of report cannot be used to run a dashboard report?
A.Tabular
B.Matrix
C.Summary
D.None of the above

26.Your organization is a US-based company with a default currency of US Dollars. As a sales rep, your personal currency set to British Pounds. You create an opportunity with a currency in British Pounds. The administrator updates the currency conversion rates. Which of the following best describes what happens to the amount of your British-Pound-based opportunity?
A.The overall opportunity amount does not change but the converted amount in a report does
B.The overall opportunity amount and converted amount in a report changes
C.Only newly created opportunities reflect the change
D.Only historically created opportunities reflect the change

27.Custom Links can be used for the following:
A.Launching an External URL
B.Running an S Control
C.Running a report
D.All of the Above

28.It is possible to share a custom object record manually
A.True
B.False

29.You can customize the Opportunity Stage Historyrelated list on an Opportunity Page Layout.
A.True
B.False

30.It's possible to view a forecast based on all of the following  EXCEPT:
A.Territory
B.Product Family
C.Date Range
D.Sales Team

31.Which of the following does a Profile control?
A.Username and Password
B.Role level access
C.Read, Create, Edit, and Delete permissions
D.Sharing rules

32.If a lead, with a single marketing campaign isconverted, the campaign information will map to the newly created contact and opportunity record automatically
A.True
B.False

33.When a manager overrides a subordinate's forecast,the subordinate can see the manager's override
A.True
B.False

34.Related Lists display the many side of a one-to-manyrelationship
A.True
B.False

35.Case Assignment Rules are based on elapsed time
A.True
B.False

36.When test driving an application on the AppExchange Directory, it is not possible to view the S-Control configurations of that application
A.True
B.False

37.Validation rules may evaluate an opportunity line itemagainst the opportunity it's associated with
A.True
B.False

38.All of the following records may be imported via the import    wizards EXCEPT
A.Opportunities
B.Accounts/Contacts
C.Custom Objects
D.Solutions
E.Leads

39.An S-Control may be all of the following EXCEPT:
A.HTML
B.XML
C.URL
D.Snippet

40.If a profile does not have access to an application, thatprofile will also not have access to the tabs and objects of that application
A.True
B.False

41.Which type of field cannot have universal requiredness?
A.Lookup
B.Text
C.Email
D.Number

42.Custom Web Tab may consist of all the following EXCEPT:
A.A URL
B.A URL that passes salesforce.com data like an organization's name
C.An S-Control
D.An S-Control snippit

43.Custom lead fields can be mapped to which sets of objects in salesforce.com?
A.Account, Contact, Opportunity, or Campaigns
B.Account, Contact, or Opportunity
C.Account or Contact Only
D.Contact or Opportunity Only

44.Once a field is hidden from a Profile using 'Field Level Security', a  User associated to that Profile can still see the field using the following:
A.List Views
B.Reports
C.Search
D.None of the above, the user cannot see the field at all

45.It's possible to relate a person account to a contact on a business account.
A.True
B.False

46.Your customer is using Professional Edition. they want the ability to trigger an email every time an opportunity reaches 90% and the amount of the opportunity is one million dollars. What is the best way to accomplish this?
A.Big Deal Alert
B.Workflow Rule
C.Escalation Rule Entry
D.Assignment Rule Entry

47.How is the expected revenue calculated in the opportunity?
A.Amount multiplied by the total price of all opportunity line items
B.The sales price on any line item times the probability of the opportunity
C.Opportunity Amount multiplied by the probability
D.Amount multiplied by the discount percent

48.A custom lookup field can be added to create a relationship  between a standard object and which of the following objects?
A.Users and Custom Objects
B.Leads, Accounts, Contacts and Custom Objects
C.Users, Custom Objects and Campaigns
D.Custom Objects, Contract and Campaigns

49.Assume the Organization Wide default sharing is set to private for all objects and no sharing rules have been created. You have two users in the Sales Rep Role, can they view each other's data?
A.Yes
B.No

50.Based solely on the role hierarchy a manager can do all of the following EXCEPT:
A.View, edit, delete, and transfer his/her and his/her subordinates records
B.Extend sharing on both his/her and his/her subordinate's records
C.View all folders his/her Subordinate has access to, i.e., Reports, Documents, and Email Templates
D.View records his subordinate does not own but can view

51.When you delete a parent record, you will also deletethe child record if that child record has a lookup relationship to the deleted record
A.True
B.False

52.Which action must be taken to view contacts associated with a case in the console?
A.The related lists of the case page layout must be modified
B.The custom links of the case page layout must be modified
C.The related object of the case page layout must be modified
D.The mini page layout of the case page layout must be modified

53.All fields on the Approval page layout are available toview on the Approval History related list
A.True
B.False

54.Which of the following relationships are correct?
A.Lead, Contacts, and Opportunities can be associated to only one Campaign
B.Leads and Contacts can be associated to several Campaigns, but an Opportunity can have only one Campaign
C.Leads and Opportunities can be associated to several campaigns, but Contacts can only have one Campaign
D.Leads, Contacts, and Opportunities can be associated to several Campaigns

55.A Workflow Approval process may be used for all of the following objects EXCEPT:
A.Opportunity
B.Users
C.Assets
D.Contracts

56.Which of the following features is not available in Professional Edition?
A.Big Deal Alert
B.Workflow
C.Account Sharing Rules
D.Multi-Currency

57.The formula editor may be used all of the following places EXCEPT:
A.S-Control
B.Formula Field
C.Default Values on Standard Fields
D.Workflow Field Updates

58.All of the following are types of AppExchange Applications EXCEPT:
A.Composite
B.Client
C.Provisional
D.Native

59.All of the following are true about Default Sales Teams EXCEPT:
A.Default Sales Teams are configured on a user record
B.Default Sales Teams may be added manually to an opportunity record
C.Default Sales Teams may be added automatically to an opportunity
D.Default Sales Teams may be added manually to an account record

60.Which one does NOT apply to Custom Formula Fields:
A.Custom Formula Fields can reference other formula fields
B.Custom Formula Fields can reference standard fields
C.Custom Formula Fields can reference custom fields
D.Custom Formula Fields can calculate across objects

61.Users can be deleted from salesforce.com
A.True
B.False

62.If you are added to a Sales Team with read/write access you then have the ability to extend sharing on the opportunity to other users.
A.True
B.False

63.When configuring Customizable Forecasting, you can set which of the  following Forecast Dates for determining which opportunities contribute to the forecast?
A.Opportunity Close Date Only
B.Product Date Only
C.Schedule Date Only
D.Commit Date
E.Opportunity Close Date, Product Date, Schedule Date

64.Select the best component to use if you want to list the top five sales performers on a dashboard.
A.Chart
B.Table
C.Metric
D.Gauge

65.Custom formula fields are recalculated:
A.Nightly
B.Every twenty minutes
C.Once per user session
D.Each time a user views the record

66.What are the opportunity defaults when converting a lead to an opportunity?
A.Stage Defaults to first option in the picklist, close date defaults to the last day in the quarter, and the amount defaults to blank
B.Stage defaults to first option in the picklist, close date defaults to 3 months from conversion date, and amount defaults to blank
C.User defines amount, close date, and stage upon conversion
D.None of the above

67.What is the difference between the Marketing User Profile and the Marketing User checkbox at the User level?
A.They are the same thing
B.Marketing User Profile allows users to create and edit Campaigns Marketing User checkbox allows users to import Leads.
C.Marketing User Profile allows users to import Leads. Marketing User checkbox allows users to create and edit Campaigns.
D.None of the Above

68.How many other fields may a custom lead field be mapped to when converting a lead?
A.One custom field
B.Two custom fields
C.Three custom fields
D.Custom lead fields cannot be mapped

69.Folders are used to manage:
A.Either Reports, Price Books, Documents. or Email templates
B.Either Reports, Dashboards, Documents, or Products
C.Either Reports, Dashboards, Documents, or Email templates
D.Either Reports, Dashboards, Documents, or Other Folders

70.It is possible for a Page layout to be associated with a Record Type.
A.True
B.False

71.Which of the following object relationships is NOT allowed?
A.Standard object as the "master" and a custom object as the detail
B.Custom object as the master" and a standard object as the detail
C.Custom object as a lookup to a standard object
D.Custom object as a lookup to a custom object

72.Which Custom Object relationship has no effect on deletion or security of the related object?
A.Master-Detail relationship
B.Lookup relationship
C.Open relationship
D.None of the above

73.All of the following actions may take place on a Workflow Rule EXCEPT:
A.Outbound API message
B.Update Field
C.Create a Task
D.Create an Event

74.      All of the following may be used when updating a record using the  AppExchange Data Loader EXCEPT:
A.External Id
B.Parent External Id
C.Record Id
D.Record Number

75.A Record Type may determine the default value of a picklist field.
A.True
B.False

76.With Client Management enabled, when a lead is converted without a value in the company field, it becomes a person account.
A.True
B.False

77.The Campaign ROI Analysis Report uses which of the following calculations to determine the ROI percentage for a campaign?
A.Total Amount of Opportunities / Expected Revenue
B.Amount of Won Opportunities / Budgeted Cost
C.Expected Revenue / Budgeted Cost
D.(Amount of Won Opportunities minus Actual Cost) / Actual Cost

78.You can use standard reports when creating
A.True
B.False

79.The difference between an opportunity record type and a sales process is:
A.The sales process controls the stage field, the record type controls all other picklist fields
B.The record type controls the stage field, the sales process controls all other picklist fields
C.The record type controls the picklist fields
D.The sales process controls all picklist fields

80.An S-Control may be used in all of the following ways EXCEPT:
A.Dashboard Component
B.Custom Button
C.Custom Link
D.Import Wizard

81.Data validation will be enforced when converting a lead
A.True
B.False

82.Assets are related to which of the following sets of objects?
A.Opportunities, Products, Cases, Accounts, and Contacts
B.Products, Cases, Accounts, and Contacts
C.Cases, Contracts, Accounts, and Contacts
D.Opportunities, Cases, and Accounts
E.Opportunity Line Items, Cases, Accounts, and Contacts

83.All of the following may be uploaded to the AppExchange Directory EXCEPT:
A.Custom Tabs
B.Custom Fields on Custom Objects
C.Custom Fields on Standard Objects
D.Custom Assignment Rules

84.Which objects can be customized for history tracking?
A.Solutions, Cases, Leads and Opportunities
B.Cases, Leads, Solutions, Contracts, and Custom Objects
C.Campaigns, Contracts, Custom Objects, and Solutions
D.Opportunities, Leads, and Contracts

85.Fields hidden using Field Level Security are subject to Data Validation Rules.
A.True
B.False

86.If you have Read Only access to an account, can you add a task or event to the account?
A.True
B.False

87.Custom Formula fields do Not support which of the following functional expression?
A.Adding multiple records together
B.If/then/else conditional statements
C.Clickable image buttons
D.Combine text strings together

88.A self service portal user may close their cases using Suggested Solutions in the self service portal.
A.True
B.False

89.Default values are available for standard text fields
A.True
B.False

90.All of the following are true about Opportunity Pipeline and  Forecast reporting EXCEPT:
A.Pipeline reports may include omitted opportunities from the forecast
B.Forecasts may be overridden
C.Pipeline reports may be overridden
D.Opportunity stages may be used to determine the forecast category of an opportunity

Thursday 6 August 2015

About American Express F2F Interview Questions (salesforce)

 American Express F2F Interview Questions (Salesforce)


Trigger should perform based on user requirement?


It should Trigger when user want to trigger & shouldn’t when trigger don’t want?


What are default methods for Batch Apex?

(Ans: start(), execute() and finish())


Give your explanation on Analytical snapshot?


Types of Triggers?


Other than Data Loader any other way to import Bulk Data?


Explain any scenario occurred you to work beyond Governor Limits?


How u will do Mass Insert through trigger?


If I want to Insert, Update any record into ‘Account’. What trigger I have to use?

About TCS F2F interview Questions (Salesforce)

   TCS Face to Face interview Questions (Salesforce)


Tell us about your projects that you have did ?


What are standard objects used in your project?


Call outs?


Governor Limits?


Relationships


Different types of field types?


Data Migration? Way of Data Migration ?


Roll-up summary?


What is the difference between sales cloud & service cloud?

Accenture Interview Questions (for Salesforce)


Accenture Interview questions for salesforce.com


What is Dynamic Approval process?

Assignment process & validations

Trigger events? & context variables?

Will one workflow effects another workflow?

Case management?

If we want to upload data through DataLoader, what the changes to be done?

Flow of execution in validations, triggers & workflows?
(Ans: all before triggers, Validations, Workflows, All after triggers.)

Difference between Trigger.new & Trigger.old?

Explain Batch Apex? And Why we use it ?

Syntax for upsert & undelete trigger & Purpose undelete?

Capgemini face to face Interview Questions (Salesforce)

 How About Capgemini f2f Interview Questions (Salesforce) ?


Briefly explain about yourself?

What is salesforce architecture?

What all the services provided in cloud computing?

what all the services that salesforce supports?

what is the difference between profiles and roles?

what are web services? why we need to go for them? What is WSDL? What is SOAP?

How can you say that it's "APPROVAL"?
(Someone said first we need to be approved in first round then only we will be sent to the next)

Here you attended capgemini written test. If you got selected here you will be sent to technical round..if you got selected in technical round then you will be sent to HP for client interview, because HP is client to capgemini. If you got selected finally.Then you will be put into work.  This is the scenario. which process do you apply here either "WORKFLOWS" or "APPROVALS".
(Someone said approvals,i don't know whether it's correct or not).

How you will make a class available to others for extension? (Inheritance concept)

In the process of creating a new record, how you will check, whether user has entered email or not in the email field of Account object?

How you will write a java script function that display an alert on the screen?12)What is the value of "renderas" attribute to display o/p in the form of Excel Sheet?

How you will get the java script function into Visual-force page?

Can we create a dashboard using Visual-force page? and what all the components we use here?

What are web tabs?

How you will add an attachment from VF page? tell me the component names to achieve this functionality?

Security(OWD (Organization wide defaults), Sharing Rules,Manual Sharing).

Rate yourself in salesforce?

what is your current package?

How much you are expecting?

You will be given pen and paper, they will ask you to write some simple code.

Deloitte F2F Interview Question (Salesforce)

  Deloitte F2F Interview



 We have 3 objects Account, Contact, Opportunity.   In a VF page, we need to display the names of contact & Opportunity which are related to Account.


One object (s1) & 3 tasks (t1, t2, t3) are there. Each task performing discount related stuff.   Write a trigger that should calculate the sum of 3 tasks.  And if any task is modified than trigger should fire automatically & perform the same.

(List<Task> listof tasks = [select id, name from Task where whatId=Trigger.new];)


How can you convert a lead?


What is your Role in your project?


Explain 2 VF pages developed by you?


How will you deploy? Have you ever involved in deployment?


How will you test your code through Sandbox?


What is the custom settings ?


Difference between SOSL and SOQL in Salesforce ?


Custom settings?


What is Sales cloud & Service cloud?


Can a Checkbox as controlling field?


Sharing Rules?


Difference b/w External ID & Unique ID?


What is System.RunAs ()?


Explain  Test.setPage ()?


Why Governor Limits are introduced in Salesforce.com?

Get Gmail, Docs, Drive, and Calendar for business