Salesforce Interview Questions – Part 5

40. What is Master Detail relationship and look up relationship in Salesforce?
Ans:
Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.
Look up relationship is something like “has-a” (Containership) relationship. Where one record has reference to other records. When one record is deleted then there is no impact on other records.


41. Can we convert the lookup relationship to Master Detail relationship?
Ans:
We can convert the lookup relationship to master detail relationship if and only if all the existing record has valid lookup field.


42. In How many way we can invoke the Apex class?
Ans:

  1. Visualforce page
  2. Trigger
  3. Web Services
  4. Email Services

43. Can we create Master Detail relationship on existing records?
Ans:
No. As discussed above, first we have to create the lookup relationship then populate the value on all existing record and then convert it.


44. How validation rules executed? is it page layout / Visualforce dependent?
Ans :
The validation rules run at the data model level, so they are not affected by the UI. Any record that is saved in Salesforce will run through the validation rules.


45. What is the difference between database.insert and insert ?
Ans:
insert is the DML statement which is same as databse.insert. However, database.insert gives more flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert by using the method setOptions(Database.DMLOptions)
Important Difference:

  • If we use the DML statement (insert), then in bulk operation if error occurs, the execution will stop and Apex code throws an error which can be handled in try catch block.
  • If DML database methods (Database.insert) used, then if error occurs the remaining records will be inserted / updated means partial DML operation will be done.

46. What is the scope of static variable ?
Ans:
When you declare a method or variable as static, it’s initialized only once when a class is loaded. Static variables aren’t transmitted as part of the view state for a Visualforce page.

Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.


47. Other than SOQL and SOSL what is other way to get custom settings?
Ans:
Other than SOQL or SOSL, Custom seting have there own set of methods to access the record.
For example : if there is custom setting of name ISO_Country,

SO_Country__c code = ISO_Country__c.getInstance("˜INDIA');
//To return a map of data sets defined for the custom object (all records in the custom object), //you would use:
Map<String,ISO_Country__c> mapCodes = ISO_Country__c.getAll();
// display the ISO code for India
System.debug("˜ISO Code: "˜+mapCodes.get("˜INDIA').ISO_Code__c);
//Alternatively you can return the map as a list:
List<String> listCodes = ISO_Country__c.getAll().values();

48. What happen if child have two master records and one is deleted?
Ans :
Child record will be deleted.

read more in this article.


49. What is Difference in render, rerender and renderas attributes of visualforce?
Ans:
render – It works like “display” property of CSS. Used to show or hide element.
rerender – After Ajax which component should be refreshed – available on commandlink, commandbutton, actionsupport etc.
renderas – render page as pdf, doc and excel.


50. What is Scheduler class in Apex and explain how to use Crone statement to Schedule Apex class?
Ans:
The Apex class which is programed to run at pre defined interval.
Class must implement schedulable interface and it contains method named execute().
There are two ways to invoke schedular :

  1. Using UI
  2. Using System.schedule

The class which implements interface schedulable get the button texted with “Schedule”, when user clicks on that button, new interface opens to schedule the classes which implements that interface.
To see what happened to scheduled job, go to “Monitoring | Scheduled jobs

Example of scheduling :

scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
system.schedule('Merge Job', sch, m);

To see how to make crone job string – Refer this Online Crone Expression Generator tool .

Note : Salesforce only accepts integer in Seconds and Minutes. So, lets say if you want to run Apex job on every 10 minutes, crone statement will be ‘0 0/10 * 1/1 * ? *’ and salesforce will throw an error saying “System.StringException: Seconds and minutes must be specified as integers“. That mean like Time based Workflow, minimum interval to schedule job is 1 hour.


Posted

in

, , ,

by

Tags:


Related Posts

Comments

37 responses to “Salesforce Interview Questions – Part 5”

  1. […] Part – 1 | Part – 2 | Part – 3 | Part – 4 – Dynamic Apex | Part – 5 […]

  2. Vinayhnk60 Avatar
    Vinayhnk60

    need more faqs…plzzzzzzzzzz

    1. JitendraZaa Avatar
      JitendraZaa

      Part6 added. Soon 7 will be released.

      1. Rare nick Avatar
        Rare nick

        subject:implementing functionality like Copy Billing Address to Shipping Address in accounts 
        Is it possible to implement  a functionality ????like Copy Billing Address to Shipping Address link (which is avilable in account object Address Information pageblock )  in my custom object

        1. JitendraZaa Avatar
          JitendraZaa

          Sure, But you will need to develop Custom Visual force page for your custom object. Javascript may be used here.

          1. Nivasonline4u Avatar
            Nivasonline4u

            HI jitendra you have said previously that we dont need to have coding knowledge but as i have seen poeple asking you questions regarding methods, triggers and functions and OOPS concepts. so please help me as i am MBA graduate without any programming knowledge do u suggest me to learn this course.

          2. JitendraZaa Avatar
            JitendraZaa

            Hi, The salesforce is Big product. There are two career path here :
            1. Admin and Consultants
            2. Developers and Architects

            As you are MBA student you can choose first one.

          3. manoj Avatar
            manoj

            thanks Jitendra,please send me some useful document in my mail id mpmanojdas3@gmail.com
            I am a tecnical student and i chose the 2nd carrier path.please help me sir.

  3. Rare nick Avatar
    Rare nick

    implementing functionality like Copy Billing Address to Shipping Address in accounts 

    Is it possible to implement  a functionality ????like Copy Billing Address to Shipping Address link (which is avilable in account object Address Information pageblock )  in my custom object

  4. Manohar Avatar
    Manohar

    Difference between External ID and Unique ID?

  5. […] – 1 | Part – 2 | Part – 3 | Part – 4 – Dynamic Apex | Part – 5 | Part – 6 | Part – […]

  6. Krk127487 Avatar
    Krk127487

    Hi ,
    This is ram. I am new to salesforce.I have good knowledge on java programming.Can we get other class reference in apex class with out using inner class(like in java new class reference or object by importing packages).

    Thanks for advance help.
    Thanks
    Ram

    1. JitendraZaa Avatar
      JitendraZaa

      Hi Ram,
      You can have access to other class like JAVA in Apex also.

      1. Krk12787 Avatar
        Krk12787

        thanks for your response.
        how can i declare   packages , i am getting error .plz give any sample code  or any referece link

        1. JitendraZaa Avatar
          JitendraZaa

          You cannot declare package at class level in Apex

          1. Krk12787 Avatar
            Krk12787

            thank you…………..

            How to import another class and another class fieds ,methods in our current class and how to access
            plz………
             give me sample code

    2. Krk12787 Avatar
      Krk12787

      thanks for your response.

      how can i declare   packages , i am getting error .
      plz give any sample code  or any referece link

  7. Anilvelaga555 Avatar
    Anilvelaga555

    Can i delete the child records if the parent is deleted but relationship should be a Lookup relationship…is there any way ..please let me know

    Thanks in Advance

    1. Chekuri Nari Avatar
      Chekuri Nari

       yes u can…. think well it’s very easy logic

    2. Prakash Jain Avatar
      Prakash Jain

      Use Isdelete Trigger and delete the lookup record in the Trigger!

  8. Sai Avatar
    Sai

    how to download these parts

    1. JitendraZaa Avatar
      JitendraZaa

      You cant!!!

      1. Anonymous Avatar
        Anonymous

        Hi Jitendra, My requirement is I have to do integration of salesforce with third party which is having REST API. This is kind of POC. I want to update accounts created in salesforce to be in the third party. Can you guide me ?

  9. Jcharugundla Avatar
    Jcharugundla

    How to write the error messages in the Triggers

    1. JitendraZaa Avatar
      JitendraZaa

      using objectName.addError(‘Your message here’);

  10. Nurzum Avatar
    Nurzum

    Great Posts on Salesforce, keep up the good work! 🙂

  11. Mitul Avatar
    Mitul

    40. What is Master Detail relationship and look up relationship in Salesforce?
    Ans:

    Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.

    In Master Detail relationship we can not calculate AVG.

  12. MRB Avatar
    MRB

    In a data model object A is related to B, B is related to C. How will a developer create a report to include fields of A and C?

    a. Create lookup relationships between A,B and C
    b. Create a custom report type with A, B and C, and use it in the report
    c. Create a custom report with A and C fields as relationships already
    exist.
    d. Report cannot be created

    1. JitendraZaa Avatar
      JitendraZaa

      b. Create a custom report type with A, B and C, and use it in the report

      1. MRB Avatar
        MRB

        Thanks Jiten.

        An application was designed without considering whether requirements for reports include dashboards. Out of the following statements which one is TRUE?

        a. The data model will support all the requirements of the application,including reports and dashboards

        b. Reports are part of the application and application design will take care of it

        c. No special considerations for reports or dashboards are required as Salesforce can natively take care of the requirements

        d. The data model and the application will not cater for reports and dashboards

        1. JitendraZaa Avatar
          JitendraZaa

          d. The data model and the application will not cater for reports and dashboards

          1. MRB Avatar
            MRB

            64. A job application object has a child review object to store candidate reviews. The review needs to be tracked between a score of 1 to 5. The score has to be a choice between 1 and 5 displayed as a radio button. How will a developer cater to this requirement?

            a. Create 5 fields for scores (1 to 5) of type radio-button and use it in review page layout

            b. Create a dependent picklist that feeds the radio button type field

            c. Create a formula field

            d. Create a Visualforce page with radio buttons for the review object

            63. In a recruiting application a position that is of type critical should not be kept open for more than 14 days. How will you develop the business logic to cater to this?

            a. Time-dependant workflow action to send an e-mail to the owner after 14 days

            b. Time-dependant workflow action to send the record for review to owner after 14 days

            c. Time-dependant workflow action to send an e-mail to the owner before 14 days

            d. Time-dependant workflow action to close the position after 14 days

            62. A recruiting application has a position object that contains location, department and other information relating to a position. We need to create a report that is grouped by department but not by locations. What is the best type of report a developer would choose?

            a. Summary report

            b. Tabular report

            c. Matrix report

            d. A report using Visualforce

            61. How do you highlight totals in a report?

            a. Roll-up summary field

            b. Formula field

            c. Custom summary field

            d. Summary totals

            60. A customer has a requirement to filter columns in the related list. As a developer how will you accomplish this?

            a. Use the filter option in the related list section of the page layout

            b. Use the filter option in the related list section of the mini page layout

            c. Use the filter option in the detail page layout of the related list object

            d. Build a Visualforce component with a filter to replace the related list section of the page layout

            59. In a master-child relationship between a standard object and custom object which of the following statements is NOT true? Please select two (2) items.

            a. The standard object is always the master

            b. The custom object is always the master

            c. The custom object is always a child

            d. The standard or custom object can be a master

            e. The standard object is never a child

            58. Universal containers need to make all records of an object visible to all users when it is in ‘Approve’ status. The records are created with “New” status and are only visible to a select set of users. How will a developer implement this?

            a. Set the object level sharing to private, add a workflow rule to update the sharing rule when status changes.

            b. Set the object level sharing to public read-only, restrict the sharing when status is New.

            c. Set the object level sharing to private, create a public group with appropriate users, modify manual sharing to public group based on status

            d. Create role hierarchy, modify the user profiles when status changes

            57. What are the components of the dashboard that use grand totals? Please choose two (2) items.

            a. Chart

            b. Metric

            c. Table

            d. Gauge

            56. In Master-Detail relationship scenario the fields of the parent object need to be displayed in the related list. How will a developer design this?

            a. Cross-object formula field

            b. Workflow rule

            c. Validation rule

            d. Assignment rule

            55. Object X has a lookup to object Y. Which of the following statements are TRUE? Please choose two (2).

            a. Fields of both X and Y are accessible from object Y

            b. Fields of object Y can be accessed from object X

            c. Fields of both Y and X are accessible from object X

            d. Fields of object X can be accessed from object Y

            54. In a recruiting application, salary is a child object to a parent position object via a Master-Detail relationship The min pay and max pay fields of salary object cannot be modified when the Position status on the parent is ‘Approve’. How would a developer design this?

            a. Create a Visualforce component on the position detail page

            b. Rollup-summary field

            c. Validation rule on position object

            d. Formula field on the salary object

            e. Validation rule on the salary object

            53. In a Master-Detail relationship, what happens when the a record is deleted from the parent object?

            a. Parent record alone gets deleted

            b. Exception occurs

            c. Parent and child record will not be deleted

            d. All child records are deleted

            52. What field can be controlled by a translation workbench?

            a. Rule criteria

            b. Formula

            c. Validation errors

            d. Assignment rules

            51. What is a junction object?

            a. Object with lookup relationship

            b. Master detail relationship

            c. Object with two lookup relationships

            d. Object with two Master-Detail relationships

            50. What layer of model-view-controller paradigm are standard or custom objects associated with?

            a. View

            b. Model

            c. Controller

            d. View and controller

            49. Where do you change the hover detail?

            a. Mini view

            b. Page layout

            c. Profile

            d. Mini page layout

            48. What are the components belong to the model of the model-view-controller design paradigm? Please select three (3) choices.

            a. Custom relationship

            b. Custom page layout

            c. Custom object

            d. Custom field

            e. Workflow rules

            47. What will cause the analytic snapshots run to fail? Please select three (3) choices.

            a. The source report has been deleted

            b. The target object has a trigger on it

            c. The running user has been inactivated

            d. The target object is a custom object

            e. The source report is saved as matrix report

            46. How does Salesforce enforce data access using role hierarchy?

            a. Users are given access to the records owned by the users who are below them in the role hierarchy

            b. Users are given access to the records owned by the users who share the same role in the role hierarchy

            c. Users are given access to the records accessible by the users who are below them in the role hierarchy

            d. Users are given access to the records accessible by the users who are above the role hierarchy

            45. What is true about a Master-Detail relationship? Please select two (2) choices.

            a. When the parent record has been deleted, all the child records will be deleted

            b. You can have a child record without the parent record

            c. You have to expose the master lookup field on the child detail page layout

            d. You cannot delete a child record

            44. For the order management application, the developer has created a custom object to store the product line and product combination. When creating an order, the product line and product combination need to be consistent. What is the best option for implementing this?

            a. Use a workflow to update the product automatically based on the product line

            b. Create a validation rule using IF

            c. Create a formula field to enforce the combination

            d. Create a validation rule using VLOOKUP

            43. What are the different custom tabs that you can create? Please select three (3) choices.

            a. Web tab

            b. Apex tab

            c. Visualforce tab

            d. Custom object tab

            e. Standard object tab

            42. When you create a custom tab for a custom object, what are the features that are available by default? Please select two (2) choices.

            a. Sidebar search object

            b. Custom reporting

            c. Quick create

            d. Ability to track activity

            41. What is true about a cross-object formula field for a Master-Detail relationship?

            a. You can only create a cross-object formula field on the parent object

            b. You can only create a cross-object formula field on the child object

            c. You can create a cross-object formula field on both the parent and child object

            d. A cross-object formula field is not available for a Master-Detail relationship

            40. What is true about a junction object?

            a. A custom object that has two Master-Detail relationships

            b. A custom object that has a Master-Detail relationship

            c. A standard object that has two Master-Detail relationships

            d. A standard object that has a Master-Detail relationship

            39. What are the data types that are supported by a formula field? Please select three (3) choices.

            a. Text

            b. Percent

            c. E-mail

            d. Currency

            e. Phone

            38. An organization wants to create a field to store manager data on the user object. The manager field is a reference to another user record. What type of relationship should be used?

            a. Master-Detail

            b. Hierarchical

            c. Lookup

            d. Many-to-many

            37. Using the Force.com platform declarative model to build an application, which of the following do you NOT have to do? Please select three (3) choices.

            a. Install a database server

            b. Configure an application using clicks not code

            c. Deploy a web server

            d. Administer and e-mail server

            36. Select the Salesforce.com edition that is NOT available today.

            a. Professional

            b. Unlimited

            c. Enterprise

            d. Premium

            35. What is the best type of dashboard component to display a list of your top 10 customers?

            a. Metric

            b. Table

            c. Gauge

            d. Chart

            34. A developer needs to create a trending report. What should he/she use to get the historical data?

            a. Reports

            b. Analytic snapshots

            c. Roll-up summary

            d. Report types

            e. Audit history records

            33. Salesforce.com has notified you that they have enabled the ability to update audit fields for your organization. When inserting a record which field can you set?

            a. CreatedDate

            b. IsDeleted

            c. SysModStamp

            d. UpdatedDate

            32. Using a formula field how would a developer calculate the number of days since a record has been created? The CreatedDate field is a DateTime type field.

            a. TODAY() – DATEVALUE(CreatedDate)

            b. NOW() – DATEVALUE(CreatedDate)

            c. TODAY() – CreatedDate

            d. CreatedDate – TODAY()

            31. An organization wishes to have everyone view/edit records on an object except for a single person x who should only have read-only access to the object. What is the best way to implement the requirement?

            a. Modify the sharing access for the object to public read/write and remove user x from the role hierarchy

            b. Modify the sharing access for the object to private and remove user x from the role hierarchy

            c. Modify the sharing access for the object to public read only, create a public group with everyone except user x; create a sharing rule and define read/write access to the public group.

            d. Modify the page layout to be read-only

            30. Select the features that are available through custom report types. Please select two (2) items.

            a. Define object relationships and fields for reports

            b. Define up to 4 object relationships

            c. Define anti-join relationships

            d. Create analytic snapshot reports

            29. How can a developer get a custom object added to the quick create list?

            a. Add the object through home page component settings

            b. It is added automatically

            c. Expose a custom tab for the custom object

            d. Enable the quick create on the user profile

            28. If a parent object has a lookup relationship defined with a child object, what happens to the child object when you delete a record from the parent?

            a. The child record is deleted

            b. Nothing

            c. The parent record cannot be deleted

            d. The child record cannot be deleted

            27. What can be done with report summary totals? Please select two (2) choices.

            a. Calculate values from a previous report

            b. Calculations based on report summary totals

            c. Highlight outliers

            d. Historical analysis

            26. A developer needs to make a field that is normally accessible to most users inaccessible on the report wizard for specific users. What is the best method to fulfill that requirement?

            a. Field-level security

            b. Remove the field from the page layout

            c. Remove the field from the user profile

            d. Change my display under personal settings

            25. When creating a sharing rule, what entities can data be shared to? Please select three (3) choices.

            a. Public groups

            b. Users

            c. Roles

            d. Roles and subordinates

            e. Queues

          2. MRB Avatar
            MRB

            Hi Jiten. I am preparing for dev401 dertification. Some Question’s answers I find very confusing. So taking the help from you.

  13. MRB Avatar
    MRB

    A job application object has a child review object to store candidate reviews. The review needs to be tracked between a score of 1 to 5. The score has to be a choice between 1 and 5 displayed as a radio button. How will a developer cater to this requirement?

    a. Create 5 fields for scores (1 to 5) of type radio-button and use it in review page layout

    b. Create a dependent picklist that feeds the radio button type field

    c. Create a formula field

    d. Create a Visualforce page with radio buttons for the review object

  14. MRB Avatar
    MRB

    In a recruiting application a position that is of type critical should not be kept open for more than 14 days. How will you develop the business logic to cater to this?

    a. Time-dependant workflow action to send an e-mail to the owner after 14 days

    b. Time-dependant workflow action to send the record for review to owner after 14 days

    c. Time-dependant workflow action to send an e-mail to the owner before 14 days

    d. Time-dependant workflow action to close the position after 14 days

  15. Dhiraj Kumavat Avatar
    Dhiraj Kumavat

    how to do junction between 3 object if there is no relationship between them

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading