Parul
IndividualForum Replies Created
-
Parul
MemberSeptember 19, 2018 at 12:29 pm in reply to: Write a syntax and structure of scheduler class in Salesforce?Here some code snippet:
Apex scheduler is used to invoke Apex classes to run at specific times, first implement the Schedulable interface for the class, then specify the schedule using either the Schedule Apex page in the Salesforce user interface, or the System.schedule method.
The Schedulable interface contains one method that must be implemented, execute.
global void execute(SchedulableContext sc){}
The implemented method must be declared as global or public.The following example implements the Schedulable interface for a class called mergeNumbers:
global class scheduledMerge implements Schedulable{
global void execute(SchedulableContext SC) {
mergeNumbers M = new mergeNumbers();
}
}
The following example uses the System.Schedule method to implement the above class.
scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
system.schedule('Merge Job', sch, m);
You can also use the Schedulable interface with batch Apex classes. The following example implements the Schedulable interface for a batch Apex class called batchable:
global class scheduledBatchable implements Schedulable{
global void execute(SchedulableContext sc) {
batchable b = new batchable();
database.executebatch(b);
}
}Thanks
-
Hi hazel,
Desk.com and Salesforce work great together to increase consolidated communication with your customers, making life easier for your teams while providing awesome responsiveness to the outside world. There are two options available for a Salesforce integration depending on your needs.
Thanks
-
Parul
MemberSeptember 19, 2018 at 12:22 pm in reply to: How does Community Cloud work with Force.com?Hi hazel,
A community cloud in computing is a collaborative effort in which infrastructure is shared between several organizations from a specific community with common concerns (security, compliance, jurisdiction, etc.), whether managed internally or by a third-party and hosted internally or externally.
Thanks
-
Parul
MemberSeptember 19, 2018 at 12:21 pm in reply to: Can we fetch multiple records using controller class or not?Hi hazel,
Yes,Based oh the governor Limit (i.e. Whether Query is used in Controller or Batch Class) We Can query Multiple Records
Thanks
-
Parul
MemberSeptember 19, 2018 at 12:17 pm in reply to: How to assign permission set to a public group?Hi hazel,
Please follow the below procedure1.Permission set
2.Manage Assignement
3.Select Users
4.Assign to assign permission set to multiple users.Thanks
-
Parul
MemberSeptember 19, 2018 at 12:15 pm in reply to: What is the difference between WhoId and WhatId?Hi hazel,
WhoId is used for LeadID or ContactId,Basically WhoID in Salesforce refers to people things.The WhoId represents a human such as a lead or a contact. WhoIds are polymorphic. Polymorphic means a WhoId is equivalent to a contact’s ID or a lead’s ID. The label is Name ID.
WhoId is used for Account ID or Opportunity ID,Basically WhoID in Salesforce refers to Object things. The WhatId represents nonhuman objects such as accounts, opportunities, campaigns, cases, or custom objects. WhatIds are polymorphic. Polymorphic means a WhatId is equivalent to the ID of a related object. The label is Related To ID.
Thanks
-
Parul
MemberSeptember 19, 2018 at 9:48 am in reply to: How to get all the fields of Sobject using Dynamic Salesforce Apex?You can use this Apex code with Vf page :
<apex:page controller="GetSobjectDynamic" action="{!autoRun}">
<apex:form>
<apex:pageblock>
<apex:pageblockTable value="{!strList}" var="obj">
<apex:column value="{!obj}"/>
</apex:pageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>
...........
public class GetSobjectDynamic
{
public List<String> strList { get;set; }public void autoRun()
{
Map<String, Schema.SObjectField> objectFields = Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap();strList = new List<String>(objectFields.keySet());
} }
Hope thsi will help you.
Thanks
-
Parul
MemberSeptember 19, 2018 at 9:33 am in reply to: Other than SOQL and SOSL, what Is the way to get custom settings in Salesforce?Hi,
Adding some code snippet you can use:
Here without querying from the record we can fetch the data from server and display in viusalforce page using custom setting.
How to get the Value from custom setting
public class DemoCustomSetting
{
public List<Country__c>getData {get;set;}
public DemoCustomSetting (){
Map<String,Country__c>alldata= Country__c.getAll();getData = alldata.values();
}
}
Visualforce page
<apex:page controller="DemoCustomSetting" sidebar="false" >
<apex:form >
<apex:pageblock title="Person Details">
<apex:pageblockTable value="{!getData }" var="A">
<apex:column value="{!A.Name}"/>
<apex:column value="{!A.State__c}"/>
<apex:column value="{!A.City__c}"/>
<apex:column value="{!A.Zip_code__c}"/>
</apex:pageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>Hope this will help
Thanks
-
Parul
MemberSeptember 19, 2018 at 9:27 am in reply to: How to round the Double to two decimal places In Salesforce Apex?You can also use this:
Decimal toround = 3.14159265;
Decimal rounded = toround.setScale(2);
system.debug(rounded);thanks
-
Parul
MemberSeptember 19, 2018 at 9:24 am in reply to: What is the difference between Count() And Count(fieldname) In Salesforce SOQL?Hi
COUNT() is an optional clause that can be used in a SELECT statement in a SOQL query to discover the number of rows that a query returns.
In simple words, COUNT() returns the number of items in a group, including NULL values and duplicates.
For example:
SELECT COUNT() FROM Account WHERE Name LIKE 'a%'
SELECT COUNT() FROM Contact, Contact.Account WHERE Account.Name = 'Tester tube'
Note the following when using COUNT():
COUNT() must be the only element in the SELECT list. that is you can not add any other field with count().
Count(fieldname):
This function returns the number of rows that match the filtering conditions and have a non-null value records. An Aggregate Result object in the records field contains the number of rows. Do not use the size field for the resulting records. Again in simple words, COUNT(expression) evaluates an expression for each row in a group and returns the number of non-null values.
So count() includes nulls, the other method doesn't.
For Example:
SELECT COUNT(Id) FROM Account WHERE Name LIKE 'xyz%'
Note: COUNT(Id) in SOQL is equivalent to COUNT(*) in SQL.
Thanks
-
Hi
Test.setPage() method is used to set the context to current page, normally used for testing the visual force controller in test classes.
Thanks
-
Hi
The following are some noteworthy points about reports:
You can create a dashboard only from the matrix and summary reports.
A maximum of 2,000 rows will be displayed in a report. To view all the rows, export the report to Excel, or use the printable view for tabular and summary reports. For joined reports, the export option is not available, and the printable view displays a maximum of 20,000 rows.
In the report builder, up to 20 rows will be displayed for summary and matrix reports and up to 50 rows for will be displayed in the tabular report.
You can use five formulas per report.
You can use up to 20 field filters in a report.
To set the maximum number of records to display in a tabular report, click on Add and select Row Limit in a report builder.
By default, reports time out after 10 minutes. You can contact Salesforce.com support to extend the time-out limit to 20 minutes for tabular, summary, and matrix reports, but no extension is available for joined reports. It will continue to time out after 10 minutes.
Reports will show only the first 254 characters in a rich-text area or a long-text area.Thanks
-
Parul
MemberSeptember 19, 2018 at 4:55 am in reply to: What is aura definition bundle in Salesforce Lightning?Hi
An AuraDefinitionBundle component is a collection of component definition files, each representing a different resource such as markup code, event documentations, applications and interfaces.
Aura definition bundle contains following items:
Component: UI for lightning component
controller.js: Contains client-side controller methods to handle events in the component.
helper.js: JavaScript functions that can be called from any JavaScript code in a component’s bundle
style: Contains styles for the component.
design: File required for components used in Lightning App Builder, Lightning pages, or Community Builder.
renderer: Client-side renderer to override default rendering for a component.
documentation: A description, sample code, and one or multiple references to example components
SVG: Custom icon resource for components used in the Lightning App Builder or Community Builder.
Thanks
-
Parul
MemberSeptember 19, 2018 at 4:52 am in reply to: What are the types of custom events in Salesforce Lightning condition?All we know, that we have 2 types of Events
Application Event: Application events follow a traditional publish-subscribe model. An application event is fired from an instance of a component. All components that provide a handler for the event are notified.
<!--c:aeEvent-->
<aura:event type="APPLICATION">
<aura:attribute name="message" type="String"/>
</aura:event>
Component Event: A component event is fired from an instance of a component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.<!--c:ceEvent-->
<aura:event type="COMPONENT">
<aura:attribute name="message" type="String"/>
</aura:event>
All components inside the Application will get notified when Application event fires. where as Component event only those component will notify which are in hierarchy.Thanks
-
Parul
MemberSeptember 19, 2018 at 4:45 am in reply to: What is aura definition bundle in Salesforce?Hi
Lightning definition represents bundle and all its related resources. The definition can be a component, application, event, interface, or a tokens collection.
Unlike other metadata components, an AuraDefinitionBundle component isn’t represented by a single component file but instead by a collection of component definition files. Each definition file represents a resource in a bundle, such as markup, applications, code files (including controllers and helpers), events, documentation, and interfaces.This object is available in API version 32.0 and later.
Thanks
-
Parul
MemberSeptember 19, 2018 at 4:42 am in reply to: What are the different Governor Limits in Salesforce?HI
Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources.
1) One Trigger Per Object
A single Apex Trigger is all you need for one particular object. If you develop multiple Triggers for a single object, you have no way of controlling the order of execution if those Triggers can run in the same contexts2) Logic-less Triggers
If you write methods in your Triggers, those can’t be exposed for test purposes. You also can’t expose logic to be re-used anywhere else in your org.3) Context-Specific Handler Methods
Create context-specific handler methods in Trigger handlers4) Bulkify your Code
Bulkifying Apex code refers to the concept of making sure the code properly handles more than one record at a time.5) Avoid SOQL Queries or DML statements inside FOR Loops
An individual Apex request gets a maximum of 100 SOQL queries before exceeding that governor limit. So if this trigger is invoked by a batch of more than 100 Account records, the governor limit will throw a runtime exception6) Using Collections, Streamlining Queries, and Efficient For Loops
It is important to use Apex Collections to efficiently query data and store the data in memory. A combination of using collections and streamlining SOQL queries can substantially help writing efficient Apex code and avoid governor limits7) Querying Large Data Sets
The total number of records that can be returned by SOQL queries in a request is 50,000. If returning a large set of queries causes you to exceed your heap limit, then a SOQL query for loop must be used instead. It can process multiple batches of records through the use of internal calls to query and queryMore8) Use @future Appropriately
It is critical to write your Apex code to efficiently handle bulk or many records at a time. This is also true for asynchronous Apex methods (those annotated with the @future keyword). The differences between synchronous and asynchronous Apex can be found9) Avoid Hardcoding IDs
When deploying Apex code between sandbox and production environments, or installing Force.com AppExchange packages, it is essential to avoid hardcoding IDs in the Apex code. By doing so, if the record IDs change between environments, the logic can dynamically identify the proper data to operate against and not failPlease let us know if this will help you
Thanks
-
Parul
MemberSeptember 19, 2018 at 4:34 am in reply to: What is Lightning Data Services in Salesforce?Hi
Salesforce introduced Lightning Data Service in Winter 17 as a pilot program. Use Lightning Data Service to load, create, edit, or delete a record in your component without requiring Apex code. Lightning Data Service handles sharing rules and field-level security for you.
It’s built on highly efficient local storage that’s shared across all components that use it. Records loaded in Lightning Data Service are cached and shared across components. Components accessing the same record see significant performance improvements, because a record is loaded only once, no matter how many components are using it. Shared records also improve user interface consistency. When one component updates a record, the other components using it are notified, and in most cases, refresh automatically.
Advantages of Lightning Data Service
No need to write any Apex class
No need to write SOQL
Field level security and record sharing is inbuilt
CRUD operation supported
Shared cache is used by all standard and custom components
Auto notification to all components
Supports offline in Salesforce 1THanks.
-
Parul
MemberSeptember 18, 2018 at 9:11 pm in reply to: What are full copy and partial copy in salesforce?Hi
Partial Copy
Partial Data sandboxes include all of your organization’s metadata and add a selected amount of your production organization's data that you define using a sandbox template. A Partial Data sandbox is a Developer sandbox plus the data you define in a sandbox template. It includes the reports, dashboards, price books, products, apps, and customizations under Setup (including all of your metadata). Additionally, as defined by your sandbox template, Partial Data sandboxes can include your organization's standard and custom object records, documents, and attachments up to 5 GB of data and a maximum of 10,000 records per selected object. A Partial Data sandbox is smaller than a Full sandbox and has a shorter refresh interval. You can refresh a Partial Data sandbox every 5 days.
REFRESH LIMIT :- 5 Days
DATA LIMIT :- 5GBFull Sandbox
Full sandboxes copy your entire production organization and all its data, including standard and custom object records, documents, and attachments. You can refresh a Full sandbox every 29 days.
Sandbox templates allow you to pick specific objects and data to copy to your sandbox, so you can control the size and content of each sandbox. Sandbox templates are only available for Partial Data or Full sandboxes.
REFRESH LIMIT :- 29 Days
DATA LIMIT :- Same as ProductionThanks
-
Parul
MemberSeptember 18, 2018 at 9:07 pm in reply to: What are the types of Email Templates in Salesforce?There are diff. types of Email Templates in Salesforce are:
Text Email Templates. This template only contains text, no formatting is possible (e.g. font color, font size, bold…) ...
HTML (Using Letterhead) Email Templates. ...
Custom (without using Letterhead) ...
Visualforce.Thanks
-
Parul
MemberSeptember 18, 2018 at 9:03 pm in reply to: What are the best practices for Salesforce triggers?Best Practice:
#1: Bulkify your Code
#2: Avoid SOQL Queries or DML statements inside FOR Loops
#3: Bulkify your Helper Methods
#4: Using Collections, Streamlining Queries, and Efficient For Loops
#5: Streamlining Multiple Triggers on the Same Object
#6: Querying Large Data Sets
#7: Use of the Limits Apex Methods to Avoid Hitting Governor Limits
#8: Use @future Appropriately
Thanks
-
Parul
MemberSeptember 18, 2018 at 8:55 pm in reply to: What is the difference between Chatter API and Connect API in Salesforce?Use Chatter REST API to:
Build a mobile app.
Integrate a third-party web application with Salesforce so it can notify groups of users about events.
Display a feed on an external system, such as an intranet site, after users are authenticated.
Make feeds actionable and integrated with third-party sites. For example, an app that posts a Chatter item to Twitter whenever the post includes #tweet hashtag.
Create simple games that interact with the feed for notifications.
Creating a custom, branded skin for Chatter for your organization.The ConnectApi namespace (also called Chatter in Apex) provides classes for accessing the same data available in Chatter REST API. Use Chatter in Apex to create custom Chatter experiences in Salesforce.
Thanks
-
Parul
MemberSeptember 18, 2018 at 8:48 pm in reply to: How to schedule export or take the backup of Salesforce?If you are an Enterprise edition customer you can schedule a weekly backup by going to
Setup --> Administration Setup --> Data Management --> Data Export
Steps:
1. Sign in with the admin rights
2. in right upper corner click on your user ID and select Setup
3. In new screen go to the left down and under Administration Setup click Data Management
4. Under Data Management click Data Export
5. Now select the format, select more option and under Exported Data you can now select one or INCLUDE ALL DATA to export everything
6. Click on Start Export
7. You will see messages that the export started and you will be notify once the process completed
8. Once you receive email with the link, click the link and you will be able to download the entire data backup in zip file. Once you unzipped the file, you have it in Excel CVS format and you can now keep it on side for archive or modify the file offline.
Thanks
-
Hi
Apex annotations modify the way a method or class is used. Below is the list of annotations supported by Salesforce:
@Deprecated:
Use the deprecated annotation to identify methods, classes, exceptions, enums, interfaces, or variables that can no longer be referenced in subsequent releases of the managed package in which they reside. This is useful when you are refactoring code in managed packages as the requirements evolve. New subscribers cannot see the deprecated elements, while the elements continue to function for existing subscribers and API integrations.@Future:
Use the future annotation to identify methods that are executed asynchronously. When you specify future, the method executes when Salesforce has available resources.
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.@IsTest:
Use the isTest annotation to define classes or individual methods that only contain code used for testing your application. The isTest annotation is similar to creating methods declared as testMethod.@ReadOnly:
The @ReadOnly annotation allows you to perform unrestricted queries against the Force.com database. All other limits still apply. It’s important to note that this annotation, while removing the limit of the number of returned rows for a request, blocks you from performing the following operations within the request: DML operations, calls to System.schedule, calls to methods annotated with @future, and sending emails.@RemoteAction:
The RemoteAction annotation provides support for Apex methods used in Visualforce to be called via JavaScript. This process is often referred to as JavaScript remoting.@TestVisible:
Use the TestVisible annotation to allow test methods to access private or protected members of another class outside the test class. These members include methods, member variables, and inner classes. This annotation enables a more permissive access level for running tests only.Apex REST annotations:
@RestResource(urlMapping=’/yourUrl’):
The @RestResource annotation is used at the class level and enables you to expose an Apex class as a REST resource.@HttpDelete:
The @HttpDelete annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP DELETE request is sent and deletes the specified resource.@HttpGet:
The @HttpGet annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP GET request is sent and returns the specified resource.@HttpPatch:
The @HttpPatch annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP PATCH request is sent and updates the specified resource.@HttpPost:
The @HttpPost annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP POST request is sent and creates a new resource.@HttpPut:
The @HttpPut annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP PUT request is sent and creates or updates the specified resource.Thanks
-
Parul
MemberSeptember 18, 2018 at 8:38 pm in reply to: What are the Salesforce annotations? List all of them.I want to add some points:
An apex annotation modifies the way a method or class is used similar to annotations in Java
Annotations are defined with an initial @ symbol, followed by the appropriate keyword.
To add an annotation to a method, specify it immediately before the method or class definition.
Types of Salesforce annotations@ Deprecated
@ Future
@ Is test
@ Read-only
@ Remote actionThanks
-
Parul
MemberSeptember 18, 2018 at 8:34 pm in reply to: What is the difference between apex:pageBlockTable and apex:dataTable in Salesforce?Hi
Apex:dataTable –
An HTML table that is defined by iterating over a set of data, displaying information about one item of data per row. The body of the < apex:dataTable > contains one or more column components that specify what information should be displayed for each item of data. The data set can include up to 1,000 items.->no need to write inside <apex:pageblock> or <apex:pageblocksection>
-> there is no required value
-> the data can be displayed using custom styles
-> we need to specify column headers explicitlyApex:pageBlockTable – A list of data displayed as a table within either an < apex:pageBlock > or < apex:pageBlockSection > component, similar to a related list or list view in a standard Salesforce page. Like an < apex:dataTable >, an < apex:pageBlockTable > is defined by iterating over a set of data, displaying information about one item of data per row. The set of data can contain up to 1,000 items.The body of the < apex:pageBlockTable > contains one or more column components that specify what information should be displayed for each item of data, similar to a table. Unlike the < apex:dataTable > component, the default styling for < apex:pageBlockTable > matches standard Salesforce styles. Any additional styles specified with < apex:pageBlockTable > attributes are appended to the standard Salesforce styles. ->pageblocktable should be inside of <apex:pageblock> or <apex:pageblocksection>
-><apex:pageblocktable> has a required attribute called “value”
->it uses the standard salesforce page styles
->column headers will be displayed automaticallyThanks.