Saturday, December 4, 2021

Advanced Apex Specialist SuperBadge -source code - git

Get your Advanced Apex Specialist super badge https://github.com/virtualram/platformdeveloper2projectwork.git Advanced Apex Specialist What You'll Be Doing to Earn This Superbadge Debug and troubleshoot Apex code Develop Apex Code that will scale to large data sets Develop custom interfaces using Visualforce Design a test strategy that will ensure quality of code Concepts Tested in This Superbadge Custom metadata in Apex Code Apex sharing Apex transaction execution Aggregate SOQL queries Complex SOQL queries ConnectAPI namespace Visualforce development Data binding with Apex classes in Visualforce Visualforce performance optimization Code refactoring and reusability Usage of constants and labels Testing Apex and Visualforce Troubleshooting Apex Note Note Before you begin the challenges, please review Advanced Apex Specialist: Trailhead Challenge Help. Review the help article relating to superbadge challenges for more information about credential security. Prework and Notes You’ll probably want to jot down notes as you read the requirements (unless you have a photographic memory). So grab a pen and paper (or electronic alternative) now. Create a new Trailhead Playground for this Superbadge. If you use an existing org, you might have trouble validating the challenges. Install this unmanaged Superbadge package (package ID: 04tf4000001O5si). This package contains the schema and code needed to complete the challenges. If you have trouble installing a managed or unmanaged package or app from AppExchange, follow the steps in the Trailhead Playground Management module. Review the Product and Schedule Objects ERD Update the Product Family field on the Product2 sObject to only have the following values: Entree, Side, Dessert, Beverage Update the Product page layout to include the Initial Inventory, Quantity Ordered, and Quantity Remaining fields Update the Account page layout "Account page layout" to display the Orders related list. Remove the Contract Number field from the Order page layout if it is currently there Use the methods provided in the unmanaged package without changing their name or signature unless explicitly mentioned in the requirements below. Use Case When Renee LaFleur was in culinary school, she interned with one of the world’s most esteemed chefs, who’s renowned for his gourmet food truck with outdoor pop-up seating. Upon graduation, this experience inspired Renee to start her own food truck business: New Millennium Food Truck—a small food operation serving up big flavors. After a few years of hard work and long hours, Renee grew her business from one to five food trucks. This success has allowed her to raise capital to pursue a passion project: a business in the "pay-it-forward" model. Remembering how hard it was to get started, she wants to use her new business to provide new chefs an easier way to establish their customer base. Renee created New Millennium Delivery to allow new and emerging chefs to make a name for themselves by giving them a low-cost platform to peddle their food to the public. In return, their customers can order meals over the phone. A New Millennium Delivery representative then delivers the order and takes the happy customer’s photo, which is then provided to the chef for social media posts. Salesforce’s platform, including Apex and Visualforce, is the technology that drives New Millennium Delivery’s business. Previously, Renee had hired a developer to help her build her Salesforce application. Now, you’re the lucky developer who’s picking up where the previous developer left off. Renee requested that the previous developer create the initial version of the application in just a few short weeks in order to so it could debut at a local food and wine festival. Renee knew she was forfeiting "good" for “fast” when she put her developer on such a tight timeline, and corners were cut and best practices sometimes ignored. Ignoring those best practices affected the rest of the development process—Renee wants you to fix this. She’s asked you to review and understand the legacy code in the current application, and then implement code fixes and new functionality using best practices for programming and application design. Standard Objects New Millennium Delivery stores its data in standard Salesforce objects, including: Accounts— New Millennium Delivery's customers who order food Products—The different meal items available for purchase Pricebook Entries— The prices of meal items Orders— Orders for meals to be delivered Order Items— Products included in a customer’s order If you are not familiar with the data model for standard objects related to Product, review it here. Note that the New Millennium Delivery’s business logic doesn’t necessitate any new custom fields, relationships, or custom objects. Business Requirements Preliminary Test Data After you complete Challenge 1, review the following New Millenium Delivery Products that will be created for you in your Trailhead playground. Product Name Product Family Initial Inventory Quantity Ordered Active Standard Price Pizza Entree 25 0 true $20.00 Garlic Bread Side 20 0 true $6.00 Chocolate Cake Dessert 15 0 true $5.00 Coconut Water Beverage 10 0 true $3.00 Hamburger Entree 25 0 true $20.00 French Fries Side 20 0 true $6.00 Carrot Cake Dessert 15 0 true $5.00 Lemonade Beverage 10 0 true $3.00 Hot Dog Entree 25 0 true $10.00 Onion Rings Side 20 0 true $6.00 Jello Dessert 15 0 true $2.50 Iced Tea Beverage 10 0 true $3.00 Use Constants to Store Data At Dreamforce, you learned that an application can be made more efficient with the best practice of using constants to store data whose value can change over time, but whose purpose remains constant. You want to implement this best practice by creating constants. A few of these constants will take advantage of custom labels. As a reminder you should have already modified the Product Family picklist to only have the following active values: Entree, Side, Dessert, Beverage Create two custom labels with the following attributes: Short Description Name Categories Value Protected Component Select One Select_One constants Select one Unchecked Inventory Level Low Inventory_Level_Low constants Has a low inventory Unchecked Note: if you make a mistake when first creating a label, we recommend deleting it and recreating it from scratch. Create an Apex class named Constants, defining the following constants. Name Value Purpose DEFAULT_ROWS 5 An Integer used to control the number of rows displayed by a Visualforce page. SELECT_ONE Value of the corresponding custom label A String used to populate picklist values in Visualforce Pages. INVENTORY_LEVEL_LOW Value of the corresponding custom label A String used to determine the threshold that causes low inventory alerts. PRODUCT_FAMILY List of Schema.PicklistEntry for the Family field on the Product2 object. This list is dynamic and must always reflect the currently configured values. A list used to populate picklist values in Visualforce pages. DRAFT_ORDER_STATUS Draft A String used to indicate that an order is a “draft”—an order that is in flight. You can’t activate a draft order unless you have a line item, and you can’t have a line item unless you have an order saved in the system. ACTIVATED_ORDER_STATUS Activated A String used to evaluate if an Order is Activated or not. INVENTORY_ANNOUNCEMENTS Inventory Announcements A String used to query a Chatter Group by Name. ERROR_MESSAGE An error has occurred, please take a screenshot with the URL and send it to IT. A String used to display user friendly error messages on Visualforce pages. STANDARD_PRICEBOOK_ID Hardcoded value of the Standard Pricebook Id An Id used to create Orders and PricebookEntries in business and test code. ** *FYI* ** Normally, we would recommend doing a query and using Test.getStandardPricebookId() to get the standard pricebook Id, however, since this code is being used for both business and test logic, that’s not possible. In fact, just calling Test.getStandardPricebookId() from outside of a test method will throw a system exception. That would make it very hard on us to ensure that you completed this step properly. Use Custom Metadata Types Inventory managers told Renee they want to know when inventory is starting to run low. For instance, if there are only 15 of a type of dessert left in inventory, they want to be alerted. That is, once the inventory level of a particular product has dwindled down to the threshold of the product’s associated Product Family, they want a notification. Based on an analysis of the last few months of order data, Renee has determined the inventory threshold values for each of the Product Families. She wants to store the inventory threshold value for each Product Family, but she wants to easily modify these thresholds as sales continue to grow. After careful consideration, you determine that a custom metadata type fits the bill for meeting these requirements. Create a custom metadata type with the following attributes. Field Value Singular Label Inventory Setting Plural Label Inventory Settings Object Name Inventory_Setting Next, create a new field on the new metadata type. Field Value Type Number Field Label Low Quantity Alert Length 18 Decimal Places 0 Field Name Low_Quantity_Alert Manage Inventory Settings to create the following custom metadata records. Label Low Quantity Alert Entree 20 Side 10 Dessert 15 Beverage 5 Correctly Calculate Inventory Quantities From speaking to Sam, a sales rep, Renee learned that there are issues entering new customer orders. Sam mentioned the following issues: 1) The value of the Quantity Ordered field isn’t accurate 2) Saving a new order is often impossible because of system errors 3) Draft orders—orders that are in-flight but not yet activated—decrement available inventory prematurely. After investigating the issues that Sam raised, you’ve made notes on resolving these issues: The business logic to derive the value of the Quantity Ordered field is not only faulty, it’s also inefficient. The system should make the calculation efficiently using lean code, and correctly aggregate the Quantity Ordered. Sam correctly identified that draft orders prematurely decrement inventory levels. You can see that the previous developer tried to fix this, but then never finished. Now, you need to fix the business logic such that only successfully activated orders impact inventory levels. The logic to determine the value of the Quantity Ordered field should be updated to take into account all activated orders that are in the system, not just the orders visible to a single sales representative. The OrderTrigger should be updated to follow Apex Trigger best practices. This ensures that the business logic is modular and reusable. Additionally, the trigger definition should list only the necessary trigger events. ** FYI ** Normally this logic would apply on Update, Delete, and Undelete, and handle status changes back to Draft but in the interest of time and not making you perform repetitive tasks, we only focus on Update. Correct the Visualforce Page That Allows the Addition of Products and Pricebook Entries Renee’s previous programmer created the Product2New Visualforce page. The intention of this page is to allow an inventory manager to rapidly enter, at once, multiple new Products and related PricebookEntry records. However, inventory managers have provided feedback that the page slows down data entry and doesn’t give them all the information they need or want. To resolve this, you need to implement an override of the standard Add and New buttons on the Product object with an updated version of Product2New. The updated page should allow an inventory manager to create multiple products at once and enter an associated Unit Price for each product. Then, when the inventory manager clicks the Save button, the result in the system is that for each product entered, a related PriceBookEntry for the Standard Pricebook is created. Only entries on the page that have all fields populated should be saved; other entries shouldn’t be saved. If an error occurs during save, a savepoint should be rolled back and a friendly error message should be displayed on the screen. Note that inventory managers should be able to enter as many products as they need to, and should be able to add multiple rows to the table with each click of the page’s Add button. Renee doesn’t want to modify the Product2New page or the Product2Extension class when business requirements change in the future. To meet this need: Update the Visualforce page so that each column header displays the current field label. Update the Apex class such that the AddRows method uses the DEFAULT_ROWS constant. Create a new method named GetFamilyOptions for use by the Family picklist on the page. The GetFamilyOptions method should use both the SELECT_ONE and PRODUCT_FAMILY constants to generate the picklist options. Because you want the Product and PriceBookEntry records to be associated with each other, implement and use an inner class named ProductWrapper, with the following attributes: productRecord of type Product2 pricebookEntryRecord of type PriceBookEntry Ensure current references to the list of Products are replaced with references to a list of ProductWrapper. Inventory managers try to balance supply and demand for New Millennium Delivery’s products. They requested that a horizontal bar chart be added to the Visualforce page. They want the chart to show them the Quantity Remaining of each Product Family. When a manager clicks Add, the chart should re-render performantly. Because this chart data is useful for other purposes, it is generated from its own Apex Class named ChartHelper. Update ChartHelper to ensure the code inside always runs as the system. Complete the GetInventory method in ChartHelper to correctly calculate the aggregate of active products that have a positive Quantity Remaining, ensuring that the result is correct for all users. Renee wants this method to also be available for use by Lightning Components. Generate a Test Data Factory After some investigation, you determine that the previous programmer had decided to modularly and efficiently generate test data for unit tests, using the TestDataFactory class. However, you also notice that the class isn’t finished—it has method names but no actual logic. Complete the TestDataFactory class so that it provides an efficient way to model sample business data that can be applied to the application’s unit tests. Ensure that each method can be used as a utility method from your test classes and also that they never depend on the value of any instance member variables. ** FYI ** Normally, we’d use the @isTest annotation on the TestDataFactory class, but then you couldn't call the methods from your business logic and we couldn't call the methods to ensure they work properly. Create Unit Tests for orderTrigger and product2Extension The more recent Apex and Visualforce code implemented by the previous developer doesn’t have the minimal required test coverage, and therefore can’t be deployed. You’re a seasoned developer, and you know that all code must be tested thoroughly. Renee has asked you to ensure that each method has the minimum 75% code coverage required to be deployed, and that new and existing unit tests do not use actual customer data. After reviewing the legacy unit tests, you notice you can use the existing Product2Tests Apex class to test Product2Extension, and you can use the existing OrderTests Apex class to test OrderTrigger and its helper. Validate the Logic of orderTrigger First, create a method that can be used by test methods to verify that the Quantity Ordered field is correctly updated on Products when Orders are activated. Go back to the TestDataFactory Apex class and create a new method with the following signature: VerifyQuantityOrdered(Product2 originalProduct, Product2 updatedProduct, Integer qtyOrdered) This method should perform an assertion that verifies that updatedProduct's Quantity_Ordered__c field is equal to the sum of the originalProduct's Quantity_Ordered__c field and the value of qtyOrdered. Next, go back to the orderTests class and ensure its test methods don’t (and can’t) use live data. Create a new method named SetupTestData that is will be used to generate test data for all the unit tests in OrderTests. This method should just call the InsertTestData method in the TestDataFactory class. Finally, create a new test method named OrderUpdate_UnitTest in OrderTests. This method must activate the Orders created in your SetupTestData method using the ACTIVATED_ORDER_STATUS constant and then use the VerifyQuantityOrdered method to verify that the Quantity Ordered field on Products was increased by the trigger. ** FYI ** A method like VerifyQuantityOrdered can be useful to ensure logic is tested consistently across all your unit tests. It also makes it a lot easier for us to assess that you completed this challenge properly! As your codebase grows, you may create more of these types of methods. If so, you would want to move them into a different class than the TestDataFactory. Validate the Logic of the product2New Page Complete the Product2Extension_UnitTest in Product2Tests. This unit test should simulate a user’s visit to, and interaction with, the Product2New page and test that it behaves as expected. When a user first visits the page, there should be multiple rows displayed on the screen. Assert that the size of the productsToInsert list is equal to the DEFAULT_ROWS constant. When the Add button is clicked, an additional set of rows should be added, so assert that the size of the productsToInsert ** list is double **DEFAULT_ROWS after the button is clicked once. Don't forget to ensure that the test methods don’t (and can’t) use live data. Next, test the Save button. Verify that populated rows are saved and unpopulated rows are not saved. Loop through the rows in the productsToInsert list and populate the values of the first 5 records, and then simulate clicking the Save button. Verify that the button worked by asserting that only 5 products were saved. Be sure to run your tests when you're done to ensure they pass without failures. Automate Internal Announcements When Inventory Is Low The staff at New Millennium Delivery needs to be aware of any inventory that is running low. The previous developer had unsuccessfully attempted to do this. Renee wants you to fix the issues in the previous developer’s logic and ensure that all appropriate employees can choose to be notified, and not just those following a given product. You’ve determined that a Chatter group is an easy way for employees to opt-into receiving these notifications. Start by creating a Chatter group named Inventory Announcements and give the group this description: This group is for New Millennium Delivery employees to receive inventory announcements. Be sure to create the group so that it wont be automatically archived and that it will be accessible by all users. After reading about the ConnectAPI, you realize that a Chatter Announcement is a better fit than a FeedItem post because an announcement acts more like an alert, in that it is timely and it expires. You know that a low inventory value should prompt an announcement to be posted to the Inventory Announcements Chatter group, so an Apex trigger must be used. After reviewing the legacy code, you realize the previous programmer attempted to write this business logic in the Product2Trigger, but that logic is faulty. Posts count as DML operations, so you will need to implement the Queueable interface to ensure that a bulk operation will result in all announcements being posted, including in the event that a large volume of announcements need to be posted. Your predecessor found some code on the Salesforce Developer Forum and created the legacy AnnouncementQueueable Apex class. Use this class to get started. The AnnouncementQueueable and Product2Helper classes should use the ConnectAPI namespace to automatically post a Chatter Announcement when a product level falls below a given threshold. Modify AnnouncementQueueable to implement the Queueable interface and call its postAnnouncements method. Ensure that it requeues itself when it has more Announcements to post than limits allow. After reviewing the existing code in the product2Helper class, you realize that it too can benefit from your constants class. Modify Product2Helper to use the INVENTORY_ANNOUNCEMENTS constant instead of "group name" to ensure consistency in the app. Complete the PostAlerts method in Product2Helper to construct new AnnouncementInputs for the Chatter Group and for use with the AnnouncementQueuable Apex class. Next, complete the AfterUpdate method so that it uses the PostAlerts method when you determine that a Product’s Quantity_Remaining__c field has dropped below the threshold value captured in the custom metadata records you created previously. Best practices dictate that business logic code should be stored in Apex classes to make it reusable, easier to test, and easier to debug. Modify Product2Trigger to execute only on the After Update event and call the logic in Product2Helper. ** FYI ** Many developers (including us) prefer to use Test Driven Development and would start with Tests first. While it works well in the real world, it's not as easy to assess programatically, so stick to doing these challenges in the order provided. Complete a Controller Extension for a Visualforce Page to Enable Rapid Order Entry New Millennium Delivery’s customers love some foods so much that products frequently sell out quickly. It’s your job to ensure there’s an easy way for inventory managers to determine the food most ordered by each customer so that they can offer the benefit of personalized customer menus. The employees who take orders at New Millennium Delivery need a page that provides a streamlined process for saving orders and order items. The previous developer created a Visualforce page, OrderEdit, to facilitate this, but was not able to complete its controller extension. OrderEdit Visualforce page showing a list of products, Order Pricing Summery pie chart and the order details. Figure 1.1: The OrderEdit Visualforce Page You need to ensure that this page is used when inventory managers create or edit an Order. Complete the OrderExtension class to allow the page to show order details, a pie chart summarizing the order items and Order Amount, and a list of active products. The pie chart should display a wedge for each item in the order, with the value of the wedge equal to the quantity multiplied by the unit price. Complete the OnFieldChange method to keep track of changes to values in the Quantity or Unit Price fields. This method should also ensure that the data in the pie chart and Order Total reflects these changes and are updated on the screen. The Products available for use on the page will be the entire set of all Active Products that Millennium Delivery sells. Use the DEFAULT_ROWS constant to limit the number of rows displayed at one time in the product list. To help inventory managers find products faster, complete the SelectFamily method so that it limits the Products displayed to only those with the selected Product Family. Ensure that quantity and unit price values entered are preserved when a user filters Products by Product Family. Use the StandardSetController methods to complete the pagination methods provided, enabling the user to move through multiple pages of available products. Ensure that quantity and unit price values entered are preserved when a user paginates. Just like she requested with the product2New page, Renee doesn’t want to modify the OrderEdit page or OrderExtension class when business requirements change in the future. Copy the GetFamilyOptions method used in the Product2Extension class to complete the GetFamilyOptions method. If, at any time, the user clicks the Cancel button, none of their changes should be saved. When the user clicks Save, the Order and Order Items should be saved. Only Order Items with a Quantity greater than zero should be saved; others should not. When editing an existing Order, any Order Items that have been modified to have a Quantity of zero should be deleted. If an error occurs during save, a savepoint should be rolled back and a friendly error message should be displayed on the screen. Create Unit Tests You may recall from the Apex Testing module that testing is the key to successful long-term development and is a critical component of the development process. In addition to being critical for quality assurance, Apex unit tests are also requirements for deploying and distributing Apex. Renee has asked you to create new unit tests. Create a new method titled OrderExtension_UnitTest in OrderTests that tests all the methods in the OrderExtension class. Use the code in Product2Tests as a template. Create a new method titled Product2Trigger_UnitTest in Product2Tests that tests the logic when a Product’s Quantity Ordered value is updated. Apply best practices and be careful to ensure every test method is using the proper access modifier. Check if they are not unnecessarily being declared as global or public, when they could be private. In the Developer Console, clear all test data and then run all tests. Ensure you have 75% or higher test coverage on Product2Trigger and OrderTrigger triggers. Ensure you have 75% or higher test coverage on Product2Extension and OrderExtension classes. Ensure you have 90% or higher coverage on Constants, ChartHelper, Product2Helper, OrderHelper, and TestDataFactory classes. ** FYI ** Test Coverage is a requirement for deployment and a great way to ensure that your code is not failing. As discussed in prior badges, the purpose of your Unit Tests is not to acheive a certain percent, but rather to ensure that your business logic behaves as expected. Note Note Before you begin the challenges, please review Advanced Apex Specialist: Trailhead Challenge Help. Ready to Tackle This Superbadge? Please first complete the prerequisites and the challenge for Advanced Apex Specialist will be unlocked.

Tuesday, October 5, 2021

Steps to create and login to scratch orgs in salesforce

How to create scratch orgs,what is devhub. 1. Enable devhub 2. first command from pallete,authorise a devhub org, 3. come to vs terminal 4. List all your orgs sfdx force:org:list --all 5. Create scratch org sfdx force:org:create -f config\project-scratch-def.json --setalias scratch1 --durationdays 7 --setdefaultusername -"naren_cam" --json --loglevel fatal 6. sfdx force:org:list --all list your org to see your scratch org user ALIAS USERNAME ORG ID STATUS EXPIRATION DATE ─── ─────── ───────────────────────────── ────────────────── ────── ─────────────── (U) ren_cam test-5althihwsdlr@example.com 00D1y0000000wetEAA Active 2021-09-03 7. Generate password for scratch or user sfdx force:user:password:generate -u test-5althihwsdlr@example.com 8. View details of scratch org user sfdx force:user:display -u test-5althihwsdlr@example.com 9. Login to scratch org url with credentials

Tuesday, September 28, 2021

Difference between workflows ,flows and process builder

Workflows enable us to set up rules that are evaluated and the corresponding action is executed based on the type of change in record. Few common cases in which workflows are used are: 1. Create a new task on an event 2. Update a field 3. For email alerts 4. For outbound messages Example of workflow to update the mailing city: Process Builder is more advanced than the workflows. The major difference between workflows and process builder is the number of operations or actions they are used for performing. Process builder is used in several more complex cases like: 1. Update any related record 2. Send an email 3. Call Apex methods 4. Call a flow 5. Posting to chatter If you want to update a process created with process builder there is no way to do it. You need to clone the existing process and update it. Due to if-else criteria of process builder, a process that will need many workflows can be built with a single process. Example of a process created with a process builder for updating records in case address changes: Flows, on the other hand, is an integrated app in Salesforce that can be used to perform various operations such as execute logic, collect data from users, call apex classes and interact with Salesforce database independent of the data change events. To create flows you need cloud flow designer in salesforce. The main difference between flows and workflows is flows are user-triggered application and workflows are event-triggered. Workflows execute their actions behind the scenes while flows can display information on the screen. In workflows, actions are associated with a particular object and its related objects which is not the case with flows since they can create, update, lookup and delete records for multiple objects. Many different types of apps can be created with flow elements at a very rapid pace. The business process can be anything like: 1. Filling out a survey 2. Filling out a form 3. Working on a script The basic example of flow is shown below: Below is an example of a flow for creating a survey for collecting customer feedback. Every survey follows a flowchart. In this example, the survey starts with the customer greeting screen. This screen will display the greeting message and will ask the user permission to proceed further. Settings and selection of screen can be done from the left panel in user interface shown in the figure. After that, you can add decision from a logic panel on left if the decision is no and you want to end the survey than you can add ‘thank you customer screen’. If the decision is yes then go further and make the new screen for customer survey and add your data by how you want this survey to be done and in the end, after completion of the survey you can end the survey:

Monday, September 27, 2021

Why Python developers are in so much demand and get high salaries

Read Here Python Pay scale Scope of Python Career in 2020, Impressive salaries for python in various job roles. Python is the fastest-growing language without any threats. Python Course for beginners for only 12.99$ Software Engineer : $ 103,035 per year DevOps Engineer : $115,666per year Data Scientist : $117,345per year Machine Learning and artificial intelligence (AI)is everywhere; if you want to know how companies like Google, Amazon, and even Udemy extract meaning and insightsfrom massive data sets, this data science course will give you the fundamentals you need. Data Scientists enjoy one of the top-paying jobs,with an average salary of $120,000 according to Glassdoor and Indeed. That’s just the average! And it’s not just about money – it’s interesting work too!Salaries of Python Developers in Massachusetts (MA) and New York (NY) – $ $140,000, $137,817 in California (CA) and $130,000 in Illinois (IL). The lowest salary of Python Developers you can see in Nebraska (NE) $85,000 and Indiana (IN) $87,750.Learn Python now for 12.99$. REad full details in this link Python Course for beginners for only 12.99$

Monday, September 6, 2021

Certification aid salesforce and interview questions UDEMY course unofficial

Salesforce Interview Questions Click HERe =>Full salesforce admin tutorial and exams 1. Can two users have the same profile? Can two profiles be assigned to the same user? Profiles determine the level of access a user can have in a Salesforce org. As far as the first part of the question is concerned, Yes. One profile can be assigned to any number of users. Take the example of a Sales or Service team in a company. The entire team will be assigned the same profile. The admin can create one profile: Sales Profile, which will have access to the Leads, Opportunities, Campaigns, Contacts and other objects deemed necessary by the company. In this way, many users can be assigned the same profile. In case the team lead or manager need access to additional records/ objects then it can be done by assigning permission sets only for those users. Answering the second part of the question, each user can only be assigned 1 profile. 2. What are Governor Limits in Salesforce? In Salesforce, it is the Governor Limits which controls how much data or how many records you can store in the shared databases. Why? Because Salesforce is based on the concept of multi-tenant architecture. In simpler words, Salesforce uses a single database to store the data of multiple clients/ customers. The below image will help you relate to this concept. To make sure no single client monopolizes the shared resources, Salesforce introduced the concept of Governor Limits which is strictly enforced by the Apex run-time engine. Governor Limits are a Salesforce developer’s biggest challenge. That is because if the Apex code ever exceeds the limit, the expected governor issues a run-time exception that cannot be handled. Hence as a Salesforce developer, you have to be very careful while developing your application. Different Governor Limits in Salesforce are: • Per-Transaction Apex Limits • Force.com Platform Apex Limits • Static Apex Limits • Size-Specific Apex Limits • Miscellaneous Apex Limits • Email Limits • Push Notification Limits 3. What is a sandbox org? What are the different types of sandboxes in Salesforce? A sandbox is a copy of the production environment/ org, used for testing and development purposes. It’s useful because it allows development on Apex programming without disturbing the production environment. When can you use it? You can use it when you want to test a newly developed Force.com application or Visualforce page. You can develop and test it in the Sandbox org instead of doing it directly in production. This way, you can develop the application without any hassle and then migrate the metadata and data (if applicable) to the production environment. Doing this in a non-production environment allows developers to freely test and experiment applications end to end. Types of Sandboxes are: • Developer • Developer Pro • Partial Copy • Full 4. Can you edit an apex trigger/ apex class in production environment? Can you edit a Visualforce page in production environment? No, it is not possible to edit apex classes and triggers directly in production environment. It needs to be done first in Developer edition or testing org or in Sandbox org. Then, to deploy it in production, a user with Author Apex permission must deploy the triggers and classes using deployment tools. However, Visualforce pages can be created and edited in both sandbox and in production. Only if the page has to do something unique (different values), it would have to be developed via Sandbox. 5. What are the different data types that a standard field record name can have? A standard field record name can have data type of either auto number or text field with a limit of 80 chars. For generating auto numbers, the format needs to be specified while defining the field and after that for every record that is added, the number will get auto generated. For example:- Sr No-{1} Sr No-{2} Sr No-{3} 6. Why are Visualforce pages served from a different domain? Visualforce pages are served from a different domain to improve security standards and block cross site scripting. Take a look at the highlighted portion in the below Visualforce page:- B. Declarative Features – Salesforce Interview Questions 7. What is WhoId and WhatId in activities? WhoID refers to people. Typically: contacts or leads. Example: LeadID, ContactID WhatID refers to objects. Example: AccountID, OpportunityID 8. What is the use of writing sharing rules? Can you use sharing rules to restrict data access? Sharing rules are written to give edit access (public read and write) or public read only access to certain individuals in Salesforce org. A classic example is when:- only your managers or superiors need to be given extra credentials to your records in objects as compared to your peers. By default, all users in your organization will have organization-wide-default sharing settings of either Public Read Only or Private. To give access to more records, which users do not own, we write sharing rules. Example: Sharing rules are used to extend sharing access to users in public groups or roles. Hence, sharing rules are not as strict as organization-wide default settings. They allow greater access for those users. As far as the second part of the question is concerned, the answer is no. We cannot use sharing rules to restrict data access. It is only used for allowing greater access to records. 9. What are the different types of email templates that can be created in Salesforce? The different types of Email templates are listed in the below table:- Text All users can create or change this template HTML with letterhead Only Administrators and users having “Edit HTML Templates” permissions can create this template based on a letterhead. Custom HTML Administrators and users having “Edit HTML Templates” permissions can create this template without the need of a letterhead Visualforce Only administrators and developers can create this template. Advanced functionalities like merging data from multiple records is available only in this template C. Audit & Reporting Features – Salesforce Interview Questions 10. What is a bucket field in reports? A bucket field lets you group related records together by ranges and segments, without the use of complex formulas and custom fields. Bucketing can thus be used to group, filter, or arrange report data. When you create a bucket field, you need to define multiple categories (buckets) that are used to group report values. The advantage is that earlier, we had to create custom fields to group or segment certain data. 11. What are dynamic dashboards? Can dynamic dashboards be scheduled? Before we understand dynamic dashboards, let us first understand static dashboards. Static dashboards are the basic dashboard types that will be visible to any user who has made a report out of his data. An example of this is what a Sales manager/ Marketing manager would be able to see on his Salesforce org. In other words, a normal dashboard shows data only from a single user’s perspective. Now comes the concept of dynamic dashboards. Dynamic dashboards are used to display information which is tailored to a specific user. Let us consider the same example as above. In case the Sales manager wants to view the report generated specific to only one of his team members, then he can use dynamic dashboards. Salesforce Certification Training Course: Admin and App Builder Explore Curriculum You can use dynamic dashboards when you want to show user-specific data of a particular user, such as their personal quotas and sales, or number of case closures, or leads converted etc. You can also use a normal/ static dashboard when you want to show regional or organization-wide data to a set of users, such as a particular region’s sales number, or a particular support team’s performance on case closures. As far as the second part of the question is concerned, no we cannot schedule a dynamic dashboard. That is because whenever we open the dashboard, it will show the data generated in real-time. 12. What are the different types of reports available in Salesforce? Can we mass delete reports in Salesforce? Salesforce Report Types 1. Tabular reports Simple Excel type tables which provide a list of items with the grand total 2. Summary reports Similar to Tabular reports, but also have functionality of grouping rows, viewing subtotals & creating charts 3. Matrix reports Two-dimensional reports which allow you to group records both by row and column 4. Joined reports Multiple blocks showing data from different reports based on same or different report types Another important point to note here is that, only Summary reports and Matrix reports can be fed as data source for dashboards. Tabular and Joined reports cannot be used as data source for dashboards. Can we mass delete reports in Salesforce? Of Course we can mass delete reports in Salesforce. The option to mass delete reports can be found under Data Management in Setup. D. Data Modelling & Data Management – Salesforce Interview Questions 13. What are the different types of object relations in salesforce? How can you create them? No list of Salesforce interview questions is complete without involving relationships between objects in Salesforce. Relationships in Salesforce can be used to establish links between two or more objects. The different types of object relationships in Salesforce are: 1. Master-Detail Relationship (1:n):- It is a parent-child relationship in which the master object controls the behavior of the dependent child object. It is a 1:n relationship, in which there can be only one parent, but many children.The main concept you need to be know is that, being the controlling object, the master field cannot be empty. If a record/ field in master object is deleted, the corresponding fields in the dependent object are also deleted. This is called a cascade delete. Dependent fields will inherit the owner, sharing and security settings from its master.You can define master-detail relationships between two custom objects, or between a custom object and standard object as long as the standard object is the master in the relationship. 2. Lookup Relationship (1:n):- Lookup relationships are used when you want to create a link between two objects, but without the dependency on the parent object. Similar to Master-Detail relationship, you can think of this as a form of parent-child relationship where there is only one parent, but many children i.e. 1:n relationship.The difference here is that despite being controlling field, deleting a record will not result in automatic deletion of the lookup field in the child object. Thus the records in the child object will not be affected and there is no cascade delete here. Neither will the child fields inherit the owner, sharing or security settings of its parent. 3. Junction Relationship (Many-To-Many):- This kind of a relationship can exist when there is a need to create two master-detail relationships. Two master-detail relationships can be created by linking 3 custom objects. Here, two objects will be master objects and the third object will be dependent on both the objects. In simpler words, it will be a child object for both the master objects. 14. What happens to detail record when a master record is deleted? What happens to child record when a parent record is deleted? In a Master-Detail relationship, when a master record is deleted, the detail record is deleted automatically (Cascade delete). In a Lookup relationship, even if the parent record is deleted, the child record will not be deleted. 15. Can you have a roll up summary field in case of Master-Detail relationship? Yes. You can have a roll-up summary in case of a master-detail relationship. But not in case of a lookup relationship. A roll-up summary field is used to display a value in a master record based on the values of a set of fields in a detail record. The detail record must be related to the master through a master-detail relationship. There are 4 calculations that you can do using roll-up summary field. You can count the number of detail records related to a master record. Or, you can calculate the sum, minimum value, or maximum value of a field in the detail records. 16. Explain the term “Data Skew” in Salesforce. “Data skew” is a condition which you will encounter when working for a big client where there are over 10,000 records. When one single user owns that many records we call that condition ‘ownership data skew’. When such users perform updates, performance issues will be encountered because of “data skew”. This happens when a single user/ members of a single role own most of the records for a particular object. 17. Explain skinny table. What are the considerations for Skinny Table? In Salesforce, skinny tables are used to access frequently used fields and to avoid joins. This largely improves performance. Skinny tables are highly effective, so much so that even when the source tables are modified, skinny tables will be in sync with source tables. Considerations for skinny tables: • Skinny tables can contain a maximum of 100 columns. • Skinny tables cannot contain fields from other objects. • For full sandboxes: Skinny tables are copied to your Full sandbox organizations, as of the Summer ’15 release. 18. Which fields are automatically Indexed in Salesforce? Only the following fields are automatically indexed in Salesforce: • Primary keys (Id, Name and Owner fields). • Foreign keys (lookup or master-detail relationship fields). • Audit dates (such as SystemModStamp). • Custom fields marked as an External ID or a unique field. 19. How to handle comma within a field while uploading using Data Loader? In a Data Loader .CSV, if there is a comma in field content, you will have to enclose the contents within double quotation marks: ” “. E. Logic & Process Automation – Salesforce Interview Questions 20. For which criteria in workflow “time dependent workflow action” cannot be created? Time dependent workflow action cannot be create for: “created, and every time it’s edited”. 21. What are the types of custom settings in Salesforce? What is the advantage of using custom settings? There are two types of custom settings in Salesforce: List Custom Settings and Hierarchy Custom Settings. List Custom Settings are a type of custom settings that provides a reusable set of static data that can be accessed across your organization irrespective of user/ profile. Hierarchy Custom Settings are another type of custom settings that uses built-in hierarchical logic for “personalizing” settings for specific profiles or users. The advantage of using custom settings is that it allows developers to create a custom set of access rules for various users and profiles. 22. How many active assignment rules can you have in a lead/ case? Only one rule can be active at a time. 23. What are custom labels in Salesforce? What is the character limit of custom label? Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. The values here can be translated into any language supported by Salesforce. Their benefit is that they enable developers to create multilingual applications which automatically presents information in a user’s native language. You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length. 24. What is the difference between a Role and Profile in Salesforce? As mentioned in one of the previous Salesforce interview questions, a profile will ultimately control access to which records a user has in a Salesforce org. No user can work on the Salesforce org without being assigned a profile. The Profile is therefore mandatory for every user. Role however is not mandatory for every user. The primary function of the Role/ Role hierarchy is that it allows higher level users in hierarchy get access to records owned by lower level users in the hierarchy. An example of that is Sales Managers getting access to records owned by Sales Reps while their peers do not get access to it. 25. What are the examples of non-deterministic Force.com formula fields? Before I mention some of the examples, let me give you an introduction to deterministic and non-deterministic formula fields. Formula fields whose value will be static are referred to as deterministic fields. Whereas, formula fields whose value will be changed dynamically or whose values will have to be calculated on the fly, they are referred to as non-deterministic formula fields. A classic example of that is a formula returning the current date and time. Some examples of non-deterministic fields in Force.com are: • Lookup fields • Formula fields whose reference spans over other entities • Fields having dynamic date functions like:- TODAY() or NOW() F. Software Testing – Salesforce Interview Questions 26. Why do we need to write test classes? How to identify if a class is a test class? Software developers from around the world will unanimously agree that writing code in test classes makes debugging more efficient. Why? That is because test classes help in creating robust and error-free code be it Apex or any other programming language. Since Unit tests are powerful in their own right, Salesforce requires you to write test classes in Apex code. Why are they so powerful? Because test classes and test methods verify whether a particular piece of code is working properly or not. If that piece of code fails, then developers/ testers can accurately locate the test class having the faulty bug. Test classes can be determined easily because every test class will be annotated with @isTest keyword. In fact, if we do not annotate a test class with @isTest, then it cannot be defined as a test class. Similarly, any method within a class which has the keyword testMethod, is a test method. 27. What is minimum test coverage required for trigger to deploy? In Salesforce, if you want to deploy your code to production, then you must make sure that at least 75% of your Apex code is covered by unit tests. And all these tests must complete successfully. SALESFORCE CERTIFICATION TRAINING COURSE: ADMIN AND APP BUILDER G. Debug & Deployment Tools – Salesforce Interview Questions 28. What are the different ways of deployment in Salesforce? You can deploy code in Salesforce using: 1. Change Sets 2. Eclipse with Force.com IDE 3. Force.com Migration Tool – ANT/Java based 4. Salesforce Package H. Integration – Salesforce Interview Questions 29. What is an external ID in Salesforce? Which all field data types can be used as external IDs? An external ID is a custom field which can be used as a unique identifier in a record. External IDs are mainly used while importing records/ data. When importing records, one among the many fields in those records need to be marked as an external ID (unique identifier). An important point to note is that only custom fields can be used as External IDs. The fields that can be marked as external IDs are: Text, Number, E-Mail and Auto-Number. 30. How many callouts to external service can be made in a single Apex transaction? Governor limits will restrict a single Apex transaction to make a maximum of 100 callouts to an HTTP request or an API call. 31. How can you expose an Apex class as a REST WebService in Salesforce? You can expose your Apex class and methods so that external applications can access your code and your application through the REST architecture. This is done by defining your Apex class with the @RestResource annotation to expose it as a REST resource. You can then use global classes and a WebService callback method. Invoking a custom Apex REST Web service method always uses system context. Consequently, the current user’s credentials are not used, and any user who has access to these methods can use their full power, regardless of permissions, field-level security, or sharing rules. Developers who expose methods using the Apex REST annotations should therefore take care that they are not inadvertently exposing any sensitive data. Look at the below piece of code for instance:- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 global class AccountPlan { webservice String area; webservice String region; //Define an object in apex that is exposed in apex web service global class Plan { webservice String name; webservice Integer planNumber; webservice Date planningPeriod; webservice Id planId; } webservice static Plan createAccountPlan(Plan vPlan) { //A plan maps to the Account object in salesforce.com. //So need to map the Plan class object to Account standard object Account acct = new Account(); acct.Name = vPlan.name; acct.AccountNumber = String.valueOf(vPlan.planNumber); insert acct; vPlan.planId=acct.Id; return vPlan; } } I. Programmatic Features – Salesforce Interview Questions 32. What is the difference between a standard controller and a custom controller? Standard controller in Apex, inherits all the standard object properties and standard button functionality directly. It contains the same functionality and logic that are used for standard Salesforce pages. Custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Custom Controllers are associated with Visualforce pages through the controller attribute. 33. How can we implement pagination in Visualforce? To control the number of records displayed on each page, we use pagination. By default, a list controller returns 20 records on the page. To customize it, we can use a controller extension to set the pageSize. Take a look at the sample code below:- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 {!a.name} Previous Next 34. How can you call a controller method from JavaScript? To call a controller method (Apex function) from JavaScript, you need to use actionfunction. Look at the below piece of code to understand how a controller method is called using actionfunction. 1 2 3 4 5 6

Popular Posts

Featured Post

IPL 2024 Teams and Squads

  IPL 2024 Teams and Squads Here's a breakdown of the IPL 2024 teams and their squads based on the information provided: Group A Team Ca...

Other Posts