Parul
IndividualForum Replies Created
-
Parul
MemberSeptember 22, 2018 at 1:19 pm in reply to: How can you expose an Apex class as a REST WebService in Salesforce?HI
Apex REST Annotations
Six new annotations have been added that enable you to expose an Apex class as a RESTful Web service.@RestResource(urlMapping=’/yourUrl’)
@HttpDelete
@HttpGet
@HttpPatch
@HttpPost
@HttpPutThanks
-
Parul
MemberSeptember 22, 2018 at 1:18 pm in reply to: What is the difference between a standard controller and a custom controller in Salesforce Apex?Difference between Standard Controller & (Custom) Controller
Visualforce controllers are used to access a visual force markup associated with particular link or button. These controllers can be used to provide access to the data that should be displayed in a page, and can modify component behavior. There are number of standard controllers exists for each Salesforce object which provides the functionality similar to custom controller.A custom controller is the user defined an Apex class that implements all of the logic for a page without leveraging a standard controller. Whenever the visualforce pages need to run entirely in system mode and it does not enforce the permissions and field-level security of the current user the custom controller works. You can have controller extension to each controller in visualforce.
A controller extension is moreover an Apex class that extends the functionality of a standard or custom controller. The controller extensions can be used in following scenarios:
You want to leverage the built-in functionality of a standard controller but want to override one or more of them for custom specification such as edit, view, save, or delete.
You can add new actions.
Visualforce page which respects user permissions.
The controller extension class executes in system mode, but if it extends a standard controller, then the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, applying the sharing rules, field level security, permissions of current user. -
Parul
MemberSeptember 22, 2018 at 1:17 pm in reply to: How many callouts to external service can be made in a single Salesforce Apex transaction?As per the Salesforce Documentation A single Apex transaction can make a maximum of 100 callouts to an HTTP request or an API call.
-
Parul
MemberSeptember 22, 2018 at 1:14 pm in reply to: Why do we need to write test classes and how to identify if a class is a test class in Salesforce?Testing is a key and critical component to successful long term software development process. Salesforce.com strongly recommends using a test-driven development process which occurs at the same time as code development. Salesforce has very strong set of documentation. When I was learning salesforce unit testing, I realize that it is difficult to understand where to start read. Therefore, I summarized the unit testing for salesforce beginners to understand the basic aspects of unit testing.
There are few things to consider before you deploy or upload the code or package;75% of your Apex code must be covered by unit tests
All the tests must complete successfully
Every trigger has some test coverage (1%)
All classes and triggers must compile successfully
When you are writing a test class, you have to write test for Single Action, Bulk Action, Positive Behavior, Negative Behavior, and Restricted User.
Single Action :Test to verify that a single record produces the correct, expected result.
Bulk Action : Test not only the single record case, but the bulk cases as well
Positive Behavior : Verify that the expected behavior occurs through every expected permutation
Negative Behavior : Verify that the error messages are correctly produced
Restricted User :Test whether a user with restricted access to the sObjects used in your code sees the expected behavior
Test Class can be defined @isTest annotation. Before the Winter 12’ release we had only private test classes, but on Winter 12’ release salesforce has given the chance to write public test classes as well. Salesforce has released the public test classes for expose common methods for data creation. It can be used to setting up data that the tests need to run against. Public test methods can be called from a running test but not from a non-test request.When you create a test method,Use static
Use testMethod keyword
Use void return type
No any arguments
No data changes performed in a test method
Don’t send emails
Cannot be used to test Web service callout because web services are asynchronous and tests are synchronous. -
Parul
MemberSeptember 22, 2018 at 1:11 pm in reply to: What are custom labels in Salesforce? What is the character limit of custom label?CustomLabels
The CustomLabels metadata type allows you to create custom labels that can be localized for use in different languages, countries, and currencies.
Declarative Metadata File Suffix and Directory Location
This type extends the Metadata metadata type and inherits its fullName field. Custom labels are custom text values, up to 1,000 characters in length, that can be accessed from Apex classes or Visualforce pages. For more information, see “Custom Labels” in Salesforce Help.Master custom label values are stored in the CustomLabels.labels file. Translations for custom labels can be retrieved through Translations in Metadata API. Translations are stored in files under the translations folder with the name format of localeCode.translation, where localeCode is the locale code of the translation language. The supported locale codes are listed in Language. -
Parul
MemberSeptember 22, 2018 at 1:10 pm in reply to: How many active assignment rules can you have in a lead/ case in Salesforce?At a time only one assignment rule can be active for an Org.
But you can have a multiple entries for that rule, so that your cases will be assigned to correct queue.
You will find existing entries for your assignment rule. Try to add your entry criteria there and the case will be assigned to the correct queue based on your criteria. -
Parul
MemberSeptember 22, 2018 at 1:09 pm in reply to: What are the types of custom settings in Salesforce? What is the advantage of using custom settings?There are two types of custom settings:
List Custom Settings
A type of custom setting that provides a reusable set of static data that can be accessed across your organization. If you use a particular set of data frequently within your application, putting that data in a list custom setting streamlines access to it. Data in list settings does not vary with profile or user, but is available organization-wide. Examples of list data include two-letter state abbreviations, international dialing prefixes, and catalog numbers for products. Because the data is cached, access is low-cost and efficient: you don't have to use SOQL queries that count against your governor limits.Hierarchy Custom Settings
A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings. -
Parul
MemberSeptember 22, 2018 at 1:08 pm in reply to: For which criteria in Salesforce workflow “time dependent workflow action” cannot be created?This is where things get a bit tricky.
Since you need Time-Based Actions you have to use "Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria." But the function ISCHANGED doesn't work with this criteria.
So, what I suggest is creating a custom date field and adding an immediate Field Update action to your current workflow rule to stamp the custom date field with the Effective Delivery Date value. Then add it to your criteria on the workflow rule as an AND:
"Custom Date Field NOT EQUAL TO Effective Delivery Date"
This way if the Effective Delivery Date changes, the workflow rule will trigger again as it meets all other criteria and now these fields don't match so it re-evaluates.
-
Parul
MemberSeptember 22, 2018 at 1:07 pm in reply to: How to get the UserID of all the currently logged in users using Salesforce Apex code?You can get the current user id like this.
UserInfo.getUserId() which returns the user id of the current user.
For apex Class, you may use and UserInfo.getUserId(), and for a Visualfroce page, you may use {!$User.Id}.
Hope it helps
-
Parul
MemberSeptember 22, 2018 at 1:06 pm in reply to: What is the maximum number of rows that SOQL and SOSL can “scan”?The Governor Limits enforces the following:-
Maximum number of records that can be retrieved by SOQL command: 50,000.
Maximum number of records that can be retrieved by SOSL command: 2,000
-
Parul
MemberSeptember 22, 2018 at 1:06 pm in reply to: How many records can a select query return? How many records can a SOSL(Salesforce Object Query Language) query return?Maximum Number of SOQL queries in a transaction: 100
Maximum Number of query rows in a transaction: 50000
Maximum Number of SOSL queries in a transaction: 20
-
Parul
MemberSeptember 22, 2018 at 1:03 pm in reply to: What are the different types of collections and what are maps in Salesforce Apex?The collection is the type variables which can store multiple numbers of records. It can increase and decrease dynamically.
There are 3 types of collection
List Collection
Set Collection
Map CollectionA map is a collection of key-value pairs where each unique key maps to a single value. Keys and values can be any data type—primitive types, collections, sObjects, user-defined types, and built-in Apex types.
Example:
public static void beforeUpdateHandler(Map<Id, Account> oldMap, Map<Id, Account> newMap) {
Account oldAcc;
Account newAcc;
for (Id accId : oldMap.keySet()) {
oldAcc = oldMap.get(accId);
newAcc = newMap.get(accId);
if (oldAcc.MyCustomField__c != newAcc.MyCustomField__c) {
System.debug('MyCustomField__c has changed!');
}
}
}Thanks
-
Parul
MemberSeptember 22, 2018 at 1:02 pm in reply to: What is an attribute tag? What is the syntax for including them?HTML attribute is a modifier of an HTML element type. An attribute either modifies the default functionality of an element type or provides functionality to certain element types unable to function correctly without them. In HTML syntax, an attribute is added to an HTML start tag.
-
Parul
MemberSeptember 22, 2018 at 1:01 pm in reply to: How can you embed a Visualflow in a Salesforce Visualforce page?HI
Find the flow’s unique name.
From Setup, enter Flows in the Quick Find box, then select Flows.
Click the name of the flow.
Copy the unique name of the flow.
From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages.
Define a new Visualforce page, or open an existing one.
Add the <flow:interview> component somewhere between the <apex:page> tags.
Set the name attribute to the unique name of the flow.
For example:</apex:page>
<flow:interview name=”flowuniquename”/>
<apex:page>Click Save.
Restrict which users can access the Visualforce page.
Click Visualforce Pages.
Click Security next to your Visualforce page.
Move all the appropriate profiles from Available Profiles to Enabled Profiles by using the ‘add’ and ‘remove’ buttons.
Click Save.
Add the Visualforce page to your Force.com app by using a custom button, link, or Visualforce tabThanks
-
Parul
MemberSeptember 22, 2018 at 12:59 pm in reply to: What is the use of “@future” annotation in Salesforce Apex Classes?NOTE :-
1) Methods with the future annotation must be static methods
2) can only return a void type
3) The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types
4) Methods with the future annotation cannot take sObjects or objects as arguments.
5) You can invoke future methods the same way you invoke any other method. However, a future method can’t invoke another future method
6) No more than 50 method calls per Apex invocation
7) Asynchronous calls, such as @future or executeBatch, called in a startTest, stopTest block, do not count against your limits for the number of queued jobs
8) The maximum number of future method invocations per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater
9) To test methods defined with the future annotation, call the class containing the method in a startTest(), stopTest() code block. All asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously -
Parul
MemberSeptember 22, 2018 at 12:56 pm in reply to: What is a Visualforce component in Salesforce?Visualforce components are page-centric and most of the work is done on the server.
Thanks
-
Parul
MemberSeptember 22, 2018 at 12:54 pm in reply to: What is an sObject type in Salesforce Apex?An sObject variable represents a row of data and can only be declared in Apex using the SOAP API name of the object.
For example:Account a = new Account();
MyCustomObject__c co = new MyCustomObject__c();Apex allows the use of the generic sObject abstract type to represent any object. The sObject data type can be used in code that processes different types of sObjects.
The new operator still requires a concrete sObject type, so all instances are specific sObjects.
For example: sObject s = new Account();
Thanks
-
Parul
MemberSeptember 22, 2018 at 12:53 pm in reply to: What are the different types of object relations in Salesforce? How can you create them?There are two main types of object relationships: lookup and master-detail.
Lookup Relationships
In our Account to Contact example above, the relationship between the two objects is a lookup relationship. A lookup relationship essentially links two objects together so that you can “look up” one object from the related items on another object.Lookup relationships can be one-to-one or one-to-many. The Account to Contact relationship is one-to-many because a single account can have many related contacts. For our DreamHouse scenario, you could create a one-to-one relationship between the Property object and a Home Seller object.
Master-Detail Relationships
While lookup relationships are fairly casual, master-detail relationships are a bit tighter. In this type of relationship, one object is the master and another is the detail. The master object controls certain behaviors of the detail object, like who can view the detail’s data.For example, let’s say the owner of a property wanted to take their home off the market. DreamHouse wouldn’t want to keep any offers made on that property. With a master-detail relationship between Property and Offer, you can delete the property and all its associated offers from your system.
-
Parul
MemberSeptember 22, 2018 at 12:52 pm in reply to: What is the difference between SOQL and SOSL in Salesforce?SOQL:
1) SOQL (Salesforce Object Query Language ) retrieves the records from the database by using “SELECT” keyword.
2) By Using SOQL we can know in Which objects or fields the data resides.
3) We can retrieve data from single object or from multiple objects that are related to each other.
4) We can Query on only one table.SOSL:
1) SOSL(Salesforce Object Search Language) retrieves the records from the database by using the “FIND” keyword.
2) By using SOSL, we don’t know in which object or field the data resides.
3) We can retrieve multiple objects and field values efficiently when the objects may or may not be related to each other.
4) We can query on multiple tables.Thanks
-
Apex Transactions ensure the integrity of data. Apex code runs as part of atomic transactions. Governor execution limits ensure the efficient use of resources on the Lightning Platform multitenant platform.
Because Apex runs in a multitenant environment, the Apex runtime engine strictly enforces limits to ensure that runaway Apex code or processes don’t monopolize shared resources. If some Apex code exceeds a limit, the associated governor issues a runtime exception that cannot be handled.
Thanks
-
Parul
MemberSeptember 22, 2018 at 12:50 pm in reply to: What are the different types of reports available in Salesforce and can we mass delete them?On tis document it says it SOAP supports: describeSObjects(), query(), retrieve(), search(). No delete.
You can try the standard tool first: http://releasenotes.docs.salesforce.com/en-us/summer14/release-notes/rn_analytics_mass_delete.htm
-
Parul
MemberSeptember 22, 2018 at 12:48 pm in reply to: What are getter methods and setter methods?Hi
Getter and Setter methods are used when you want to get or set a field (int, String, etc) which is private in a class, from outside the class. Not all variables can be made public and static for obvious reasons.
Suppose you have a class User :
Class User {
private String username;
private String password;
}
For every new user, you will need a new instance of class User.
User new_user = new User();
Suppose you want to set the password for instance new_user. Since password is a private variable, you can't access it from outside.
Instead, you create a public method which can help you access the variable.
Class User {
private String username;
private String password;
public String getPassword() {
return password;
}
public void setPassword (String p){
password = p;
}
}
Now you can get/ set password through these methods.
new_user.setPassword(“29091992”); will set the password to 29091992.
Similarly new_user.getPassword(); will fetch the password for this instance.
Hope this helps.
-
Parul
MemberSeptember 22, 2018 at 12:46 pm in reply to: What are dynamic dashboards and how can they be scheduled in Salesforce?Until the system knows who to base the security and permissions around, it can't refresh.
Think of it like renting a car-- you are the driver, you have a destination, there's a car involved- but until you know which one it is and get in, you're not going anywhere. -
Parul
MemberSeptember 22, 2018 at 12:45 pm in reply to: What is the use of interfaces(in apex classes)?Hi
Reasons to use an interface:
Behavior Contract - A common method is needed on otherwise unrelated objects. The implementation of that method could be significantly different. As such, there is little benefit in inheriting the implementation (behavior).
Coupling - If code is only dependent on the interface then it is easier to change the implementation, as there no/fewer references to a specific class. E.g. I can change the way a plane flys without any risk of making birds fall out of the sky.Thanks
-
Parul
MemberSeptember 22, 2018 at 12:45 pm in reply to: What are the different types of email templates that can be created in Salesforce?Text - All users can create or change text email templates. See Create Text Email Templates in Salesforce Classic.
HTML with letterhead - Administrators and users with the “Edit HTML Templates” permission can create HTML email templates based on a letterhead. Letterheads define the look and feel of your HTML email templates. Your HTML email templates can inherit the logo, color, and text settings from a letterhead. See Create Letterhead Email Templates in Salesforce Classic.
Custom HTML - Administrators and users with the “Edit HTML Templates” permission can create custom HTML email templates without using a letterhead. You must either know HTML or obtain the HTML code to insert in your email template. See Create Custom HTML Email Templates in Salesforce Classic.
Visualforce - Administrators and developers can create templates using Visualforce. Visualforce email templates allow for advanced merging with a recipient's data, where the content of a template can contain information from multiple records. See Create Visualforce Email Templates in Salesforce Classic.