shariq
IndividualForum Replies Created
-
Hi,
With sharing Keyword: This keyword enforces sharing rules that apply to the current user. If absent, code is run under default system context. Use the with sharing keywords when declaring a class to enforce the sharing rules that apply to the current user. Use With Sharing when the User has access to the records being updated via Role, Sharing Rules, Sales Teams – any sort of sharing really.
Example:
public with sharing class sharingClass {
// Code here
}
Without sharing keyword: Ensures that the sharing rules of the current user are not enforced. Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example, you may want to explicitly turn off sharing rule enforcement when a class acquires sharing rules when it is called from another class that is declared using with sharing. Without Sharing is reserved for cases where the User does not have access to the records, but there is a need to update them based on user input.
public without sharing class noSharing {
// Code here
}
Some things to note about sharing keywords:
The sharing setting of the class where the method is defined is applied, not of the class where the method is called. For example, if a method is defined in a class declared with with sharing is called by a class declared with without sharing, the method will execute with sharing rules enforced.
If a class isn’t declared as either with or without sharing, the current sharing rules remain in effect. This means that the class doesn’t enforce sharing rules except if it acquires sharing rules from another class. For example, if the class is called by another class that has sharing enforced, then sharing is enforced for the called class.
Both inner classes and outer classes can be declared as with sharing. The sharing setting applies to all code contained in the class, including initialization code, constructors, and methods.
Inner classes do not inherit the sharing setting from their container class.
Classes inherit this setting from a parent class when one class extends or implements another.Thanks
-
Hi,
SOAP Stands for Simple Object Access Protocol. SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP. Salesforce provides programmatic access to your organization's information using simple, powerful, and secure application programming interfaces.
Apex SOAP web services allow an external application to invoke Apex methods through SOAP Web services.
Salesforce provides a WSDL (Web Service Description Language) files. They are called "Enterprise WSDL" and "Partner WSDL". A WSDL is an XML-document which contains a standardized description on how to communicate using a web service (the Salesforce API is exposed as a web service)
Thanks
-
shariq
MemberSeptember 19, 2018 at 1:40 PM in reply to: What is SLDS in Salesforce Lightning? What is the use of this?Hi,
Lightning Design System is quite a mouthful, so we’re referring to it here as the “Design System”.
You might have used other similar design systems, such as Twitter Bootstrap or Foundation for building websites. The key benefits of this Design System are:
It’s tailored for building Salesforce apps. Using the Design System markup and CSS framework results in UIs that reflect the Salesforce Lightning look and feel. The focus on building applications is an important one to keep in mind. The Design System does not over-enforce defaults such as padding and margins, in contrast to some other frameworks which are focused on building marketing pages. The Design System lets you easily specify the exact layouts you require, whilst conforming to the new Lightning UI.
It’s continuously updated. As long as you’re using the latest version of the Design System, your pages are always up to date with Salesforce UI changes.
Accessibility is baked in to the CSS framework behind the components.
The CSS is fully namespaced with the slds- prefix and scoped with the slds-scope class to avoid CSS conflicts.
The Design System bundles four types of resources to help you build applications.CSS framework — Defines the UI components, such as page headers, labels, and form elements, a grid layout system, and a single-purpose helper classes, to assist with spacing, sizing, and other visual adjustments.
Icons — Includes PNG and SVG (both individual and spritemap) versions of our action, custom, doctype, standard, and utility icons.
Font — Typography is at the core of our product. We’ve designed the new Salesforce Sans font from the ground up to give our product a distinct visual voice and personality, and we’re making it available to you as part of the Design System.
Design Tokens — These design variables allow you to tailor aspects of the visual design to match your brand. Customizable variables include colors, fonts, spacing, and sizing.Thanks
-
shariq
MemberSeptember 19, 2018 at 1:33 PM in reply to: Why should we use the Test.setCurrentPage() method in Test class on salesforce?Hi,
setCurrentPage(page) :
A Visualforce test method that sets the current PageReference for the controller.Thanks
-
Hi,
Salesforce AppExchange is Salesforce.com's cloud computing marketplace through which end users can access, download and install software apps. ... Launched by Salesforce.com in 2005, the AppExchange website became the first publicdirectory of its kind.
Thanks
-
Hi,
Salesforce Object Search Language (SOSL) is a Salesforce search language that is used to perform text searches in records. Use SOSL to search fields across multiple standard and custom object records in Salesforce. SOSL is similar to Apache Lucene.
Adding SOSL queries to Apex is simple—you can embed SOSL queries directly in your Apex code. When SOSL is embedded in Apex, it is referred to as inline SOSL.This is an example of a SOSL query that searches for accounts and contacts that have any fields with the word 'SFDC'.
List<List<SObject>> searchList = [FIND 'SFDC' IN ALL FIELDS
RETURNING Account(Name), Contact(FirstName,LastName)];Thanks
-
shariq
MemberSeptember 19, 2018 at 1:23 PM in reply to: Difference between ISBLANK and ISNULL in SalesforceHi,
Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality as ISNULL, but also supports text fields. Salesforce will continue to support ISNULL, so you do not need to change any existing formulas.
A field is not empty if it contains a character, blank space, or zero. For example, a field that contains a space inserted with the spacebar is not empty.
Use the BLANKVALUE function to return a specified string if the field does not have a value; use the ISBLANKfunction if you only want to check if the field has a value.
If you use this function with a numeric field, the function only returns TRUE if the field has no value and is not.Thanks
-
Hi,
Queues help your teams to manage service contracts, cases, leads and custom objects. Once records are placed in a queue manually or through an automatic case or lead assignment rule, records remain there until they're assigned to a user or taken by one of the queue members.
Thanks
-
Hi,
Let’s take a look at the top five things to do with Flow.
1. Guided Selling
Complex sales processes or ones that require an agent to walk through a series of questions are tailor-made for Flow. Using Flow to set up screens, fields, and choices will ensure that our users are entering data in a guided format and that you're capturing the relevant information. For more on building a simple Flow using Salesforce visual workflow, click here.2. Call Scripting
Sales isn’t the only department that can benefit from Flow. We can utilize it in our Service Centers as well. Flow is great for call scripting where an agent needs to walk through a series of questions and answers in order to capture the needed data. If your company utilizes call campaigns and call down lists, Flow will be your best friend. To watch a demo of call scripting using Flow, click here.3. Web-to-Lead or Case Enhancements
By embedding a visual workflow in a public Salesforce site, you can utilize Flow as a robust engine for your web-to-lead or web-to-case inquiries by actually referencing your Salesforce data on the fly.4. Perform Multiple Updates from a Single Screen
Often, with complex business processes and service procedures, multiple records must be updated in order to keep several departments informed about customer activity. Some examples of that include creating a case and activity, updating account and contact records, and providing answers to cases. With Flow, we present a single screen to the agent and—based on their actions—update multiple records. To see the power of Flow execute multiple records, click here.5. Reduce Training
By utilizing Flow and enforcing users to enter specific information, minor changes to business processes can be rolled out with minimal adjustments to training. Now user guides, videos, etc. can all reference prompts the user should follow to ensure correct data entry. This reduces training time and increases the speed of onboarding new customers.Thanks
-
shariq
MemberSeptember 19, 2018 at 1:16 PM in reply to: Difference between Sandbox and Development environment in Salesforce?Hi,
Sandbox
The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. You can copy your live instance to a sandbox environment (but you have to perform manually from sandbox to developer edition) where you can test any changes, implementations, AppExchange apps or updates. It can also be your hands-on training environment without risking your live data.
You can either copy your configuration and data into a sandbox environment or just the configuration. It acts exactly like your live instance, but be careful if you have workflow rules or automations because they will work in the sandbox as well.
I know that this sounds wonderful and if you don’t have it, you are dying to know how to get it. The problem is the cost. If you are on Unlimited Edition, then cost is not a problem because it comes included. But for Enterprise, Professional or Group Editions, you have to pay… and the price is hefty; anywhere between 25k-50k per year. For a lot of companies, that is more than they are paying for their live salesforce.com instance. So how do you test salesforce.com without Sandbox? It is always suggested to develop application in sandbox instance then go for LIVE.
Developer Edition
Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange. It is also a great tool for testing/training in salesforce.com. What makes this a great tool is the fact that it is free. Anyone can get a Developer Edition of salesforce.com. It is a standard Enterprise Edition with very limited storage space. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel. Once it is customized, you can use it for training, testing or anything else you want. It takes a little bit of work, but you can make it act and feel just like your live instance. The work is well worth it for the free price.
To get a copy of Developer Edition for yourself or your company go here. Play around with it. Get apps from the AppExchange. Do anything and everything that you have been scared to do your live system. If you come up with a clever way of using the system, post it on AppExchange and share your knowledge.
Thanks
-
Hi,
You can designate up to 25 External ID fields per object. External ID fields must be Custom text, number or email fields. External ID fields contain record IDs from systems outside Salesforce. You can use the upsert call to match against ExternalID fields during import or integration.
Thanks
-
Hi,
You can use the sort() method of Salesforce List class.
sort() :
Sorts the items in the list in ascending order.Thanks
-
shariq
MemberSeptember 19, 2018 at 1:11 PM in reply to: What is Wrapper Class & Where to use Wrapper Class in Salesforce?Hi,
A wrapper or container class is a class, data structure, or an abstract data type whose instances are a collections of other objects.It is a custom object defined by Salesforce developer where he defines the properties of the wrapper class. Within Apex & Visualforce this can be extremely helpful to achieve many business scenarios within the Salesforce CRM software.
Use of Wrapper Class within Salesforce:
Many times in the community boards, people have asked the questions on how they can display a table of records with a check box and then process only the records that are selected. You can do it using this below step by step instructions. You can use wrapper class to display records from multiple records within a single table based around the business needs.
Thanks
-
shariq
MemberSeptember 19, 2018 at 1:09 PM in reply to: In Salesforce, how to make an unmanaged package to managed package in DEV org?Hi,
Creating a managed package is just as easy as creating an unmanaged package. The only requirement to create a managed package is that you’re using a Developer Edition organization.
Before creating a managed package:Determine if you want to create and upload a managed or unmanaged package.
Optionally, install the License Management Application (LMA) from http://sites.force.com/appexchange. Search for License Management App to locate it. The License Management Application (LMA) tracks information about each user who installs your app. It allows you to track what users have which version, giving you a means of distributing information about upgrades.The License Management Application (LMA) can be installed in any Salesforce organization except a Personal, Group, or Professional Edition organization and does not need to be the same Salesforce organization that you use to create or upload the package, although it can be. You can also use the same License Management Application (LMA) to manage an unlimited number of your managed packages in different Developer Edition organizations.
Configure your developer settings. Your developer settings specify your namespace prefix, the Salesforce organization where you install the License Management Application (LMA), and the unmanaged package you want to convert into a managed package.
Use the following procedure to create and upload a managed package through the UI. (You can also upload a package using the Tooling API. For sample code and more details, see the PackageUploadRequest object in the Tooling API Developer Guide.)This procedure assumes you have already created a namespace and beta package. If you’re uploading a beta package for testing, see Creating and Uploading a Beta Package.Create a package:From Setup, enter Packages in the Quick Find box, then select Packages.
Click New.
Enter a name for your package. You can use a different name than what appears on AppExchange.
From the dropdown menu, select the default language of all component labels in the package.
Optionally, in the Notify on Apex Error field, enter the username of the person who should receive an email notification if an exception occurs in Apex code that is not caught by the code. If you don’t specify a username, all uncaught exceptions generate an email notification that is sent to Salesforce.
Optionally, in the Notify on Packaging Error field, enter the email address of the person who receives an email notification if an error occurs when a subscriber’s attempt to install, upgrade, or uninstall a packaged app fails. This field appears only if packaging error notifications are enabled. To enable notifications, contact your Salesforce representative.
Optionally, choose a custom link from the Configure Custom Link field to display configuration information to installers. The custom link displays as a Configure link within Salesforce on the Installed Packages page and package detail page of the subscriber's organization.
Optionally, enter a description that describes the package. You can change this description before you upload it to AppExchange.
Optionally, specify a post install script. This is an Apex script that runs in the subscriber organization after the package is installed or upgraded. For more information, see Running Apex on Package Install/Upgrade.
Optionally, specify an uninstall script. This is an Apex script that runs in the subscriber organization after the package is uninstalled. For more information, see Running Apex on Package Uninstall.
On the right side of the screen, select the Managed checkbox.
Click Save.
Optionally, change the API access privileges. By default, API access is set to Unrestricted, but you can change this setting to further restrict API access of the components in the package.
Add the necessary components for your app.Click Add Components.
From the drop-down list, choose the type of component.
Select the components you want to add. Some components cannot be added to Managed - Released packages. For a list of packageable components, see Components Available in Managed Packages. Also, S-controls cannot be added to packages with restricted API access.
Click Add To Package.
Repeat these steps until you have added all the components you want in your package.
Some related components are automatically included in the package even though they might not display in the Package Components list. For example, when you add a custom object to a package, its custom fields, page layouts, and relationships with standard objects are automatically included. For a complete list of components, see Components Automatically Added to Packages.
Optionally, click View Dependencies and review a list of components that rely on other components, permissions, or preferences within the package. For more information on dependencies, see About Dependencies. Click Done to return to the Package detail page.
Click Upload.
On the Upload Package page, do the following:Enter a Version Name, such as Spring 12. The version name is the marketing name for a specific release of a package and allows you to create a more descriptive title for the version than just a number.
Enter a Version Number, such as 1.0. For more information on versions, see Upgrading Your App.
Select a Release Type of Managed - Released.
Change the Description, if necessary.
Optionally, specify a link to release notes for the package. Click URL and enter the details in the text field that appears. This link will be displayed during the installation process, and on the Package Details page after installation. As a best practice, point to an external URL, so you can make the information available to customers before the release, and update it independently of the package.
Optionally, specify a link to post install instructions for the package. Click URL or Visualforce page and enter the details in the text field that appears. This link will be displayed on the Package Details page after installation. As a best practice, point to an external URL, so you can update the information independently of the package.
Optionally, enter and confirm a password to share the package privately with anyone who has the password. Don't enter a password if you want to make the package available to anyone on AppExchange and share your package publicly.
Salesforce automatically selects the requirements it finds. In addition, select any other required components from the Package Requirements and Object Requirements sections to notify installers of any requirements for this package.
Click Upload.
Once your upload is complete, you can do any of the following.Click Change Password link to change the password option.
Click Deprecate to prevent new installations of this package while allowing existing installations to continue operating. You cannot deprecate the most recent version of a managed package.
When you deprecate a package, remember to remove it from AppExchange as well. See “Removing Apps from AppExchange” in the AppExchange online help.
Click Undeprecate to make a deprecated version available for installation again.
You receive an email that includes an installation link when your package has been uploaded successfully.Thanks
-
shariq
MemberSeptember 19, 2018 at 12:30 PM in reply to: How to get the picklist value in Salesforce Apex class?Hi,
Lets say we have a custom object called OfficeLocation__c. OfficeLocation__c contains a number of fields, one of which is a picklist of country values called, creatively enough, Country__c. Our customer requirements are to include the picklist of countries on a Visualforce page which uses a custom controller. The first thing we need to do, within our controller is use the getDescribe() method to obtain information on the Country__c field:
Schema.DescribeFieldResult fieldResult = OfficeLocation__c.Country__c.getDescribe();We know that Country__c is a picklist, so we want to retrieve the picklist values:
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
The only thing left for us to do is map the picklist values into an <apex:selectOptions> tag can use for display.Hope this helps!
-
shariq
MemberSeptember 19, 2018 at 12:28 PM in reply to: What is the use of Metadata API in Salesforce?Hi,
Use Metadata API to retrieve, deploy, create, update or delete customization information, such as custom object definitions and page layouts, for your organization. This API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself. To create, retrieve, update or delete records, such as accounts or leads, use data SOAP API or REST API.
The easiest way to access the functionality in Metadata API is to use the Force.com IDE or Ant Migration Tool. Both tools are built on top of Metadata API and use the standard Eclipse and Ant tools, respectively, to simplify working with Metadata API.Force.com IDE is built on the Eclipse platform, for programmers familiar with integrated development environments. Code, compile, test, and deploy from within the IDE.
The Ant Migration Tool is ideal if you use a script or the command line for moving metadata between a local directory and a Salesforce org.
For more information about the Force.com IDE or Ant Migration Tool, see developer.salesforce.com.The underlying calls of Metadata API have been exposed for you to use directly, if you prefer to build your own client applications. This guide gives you more information about working directly with Metadata API.
You can use the Metadata API to manage setup and customization information (metadata) for your organizations. For example:
Export the customizations in your organization as XML metadata files. See Working with the Zip File and retrieve().
Migrate configuration changes between organizations. See deploy() and retrieve().
Modify existing customizations in your organization using XML metadata files. See deploy() and retrieve().
Manage customizations in your organization programmatically. See CRUD-Based Metadata Development.
You can modify metadata in test organizations on Developer Edition or sandbox, and then deploy tested changes to production organizations on Enterprise, Unlimited, or Performance Editions. You can also create scripts to populate a new organization with your custom objects, custom fields, and other components.
Thanks -
Hi,
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.
Thanks
-
shariq
MemberSeptember 19, 2018 at 12:14 PM in reply to: Write a syntax and structure of scheduler class in Salesforce?Hi,
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.
To schedule an Apex class to run at regular intervals, first write an Apex class that implements the Salesforce-provided interface Schedulable.
The scheduler runs as system—all classes are executed, whether or not the user has permission to execute the class.
To monitor or stop the execution of a scheduled Apex job using the Salesforce user interface, from Setup, enter Scheduled Jobs in the Quick Find box, then select Scheduled Jobs.
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 ?';
String jobID = system.schedule('Merge Job', sch, m);You can also use the Schedulable interface with batch Apex classes. The following example implements the Schedulableinterface 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
-
shariq
MemberSeptember 19, 2018 at 12:08 PM in reply to: In Batch class execute method default limit is 200.How can i Change this in salesforce?Hi,
Database.executeBatch(sObject className, Integer scopeSize) is used to execute a batch.
The Database.executeBatch method takes two parameters:An instance of a class that implements the Database.Batchable interface.
An optional parameter scope. This parameter specifies the number of records to pass into the execute method. Use this parameter when you have many operations for each record being passed in and are running into governor limits. By limiting the number of records, you are limiting the operations per transaction. This value must be greater than zero. If the start method of the batch class returns a QueryLocator, the optional scope parameter of Database.executeBatch can have a maximum value of 2,000. If set to a higher value, Salesforce chunks the records returned by the QueryLocator into smaller batches of up to 2,000 records. If the start method of the batch class returns an iterable, the scope parameter value has no upper limit. However, if you use a high number, you can run into other limits.Thanks
-
shariq
MemberSeptember 19, 2018 at 12:03 PM in reply to: How many controller extensions we can use in salesforce?Hi,
Multiple controller extensions can be defined for a single page through a comma-separated list. This allows for overrides of methods with the same name.
Thanks
-
shariq
MemberSeptember 19, 2018 at 12:00 PM in reply to: Email Template in salesforce Marketing CloudHi,
Use email templates to increase productivity and ensure consistent messaging. Email templates with merge fields let you quickly send emails that include field data from Salesforce records.
View and Edit Email Templates in Salesforce Classic
You have several options for viewing and editing your Classic email templates. You can add attachments and preview email templates too.
Clone Email Templates in Salesforce Classic
Cloning, or copying, an email template lets you use an existing email template as the basis for another template.
Types of Classic Email Templates
In Salesforce Classic, you can create four different types of email templates: text, HTML with letterhead, custom, and Visualforce. All of these email templates can include text, merge fields, and attached files.
Create Text Email Templates in Salesforce Classic
You can create plain-text email templates to send to recipients who can’t read HTML email.
Create Custom HTML Email Templates in Salesforce Classic
You can create custom HTML email templates without using letterhead. If you don’t know HTML, you can paste HTML code into your template.
Add Images to Email Templates in Salesforce Classic
You can include images, such as logos, in your custom HTML and Visualforce email templates.
Letterhead Email Templates in Salesforce Classic
A letterhead defines the logo, page color, and text settings for your HTML email templates. Use letterheads to ensure a consistent look and feel in your company’s emails.
Visualforce Email Templates in Salesforce Classic
With Visualforce email templates, users can send targeted and personalized emails. Template creators can harness the powerful Visualforce programming language to create templated email content.Hope this helps!
-
shariq
MemberSeptember 19, 2018 at 11:55 AM in reply to: Difference between 'div' and 'span' tags in SalesforceHi,
The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) whereas a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.
Thanks
-
shariq
MemberSeptember 19, 2018 at 11:54 AM in reply to: How is Access Token used with REST API in Salesforce ?Hi,
The first step in any API-based integration is getting an OAuth access token to authenticate your calls.
Using the client ID and secret call the REST Auth service to obtain an OAuth access token for authenticating your API calls. This sample call demonstrates how to POST to that resource to acquire an access token.
POST https://auth.exacttargetapis.com/v1/requestToken
Content-Type: application/json
{
"clientId": "YOUR_CLIENT_ID",
"clientSecret": "YOUR_CLIENT_SECRET"
}200 OK
{
"accessToken": "YOUR_ACCESS_TOKEN"
"expiresIn": 3600
}The access token is returned in the accessToken property. Specify this access token to authenticate all other REST API calls via the Authorization header field with the Bearer HTTP authorization scheme.
Refresh an Access Token
Note the expiresIn property in the HTTP response to the requestToken API call. Access tokens expire one hour after they are issued. If you attempt to use an expired token, you receive a 401 Unauthorized HTTP response. If this happens, refresh your access token by calling requestToken again.Follow these considerations when using the API directly and doing your own OAuth token management.
Do not request a new access token for every API call you make—-each access token is good for an hour and is reusable. Making two API calls for every one operation is inefficient and causes throttling.
Be careful where you store your client ID and secret. Never expose this information on the client side via JavaScript or store it in a mobile application. Ensure that these credentials are stored securely in your application.Hope this helps!
-
shariq
MemberSeptember 19, 2018 at 11:45 AM in reply to: What are CRUD/FLS issues in Salesforce? How can it be resolved?Hi,
FLS stands for field level security. FLS can be ensure by adding permission checks before performing DML.
Suppose we are performing DML on account object and we want to ensure FLS for name field then :For an upsert DML
Account acc = new Account();if(Schema.sObjectType.account.fields.name.isCreateable() && Schema.sObjectType.account.fields.name.isUpdateable()){
acc.name = ‘Test’;
}here it checks weather user has permission to update and create name field or not. this is how it is ensuring the FLS. similarly we can add checks for some other DML’s.
Hope this helps!
-
This reply was modified 7 years, 6 months ago by
shariq.
-
This reply was modified 7 years, 6 months ago by
