shariq
IndividualForum Replies Created
-
shariq
MemberSeptember 16, 2018 at 5:49 PM in reply to: Difference between actionPoller, actionSupport, actionFunction and actionRegionHi,
apex:ActionFunction : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
<apex:actionFunction name=”sendEmail” action=”{!sendEmailFunction}”></apex:actionFunction>
apex:ActionSupport : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.
<apex:outputpanel id=”counter”>
<apex:outputText value=”Click Me!: {!count}”/>
<apex:actionSupport event=”onclick” action=”{!incrementCounter}” rerender=”counter” status=”counterStatus”/>
</apex:outputpanel>apex:ActionPoller : This is timer component which can send AJAX request on pre-defined interval. Minimum interval is 5 sec and default is 60 sec.
<apex:actionPoller action=”{!incrementCounter}” rerender=”counter” status=”counterStatus” interval=”50″ />actionRegion : An area of a Visualforce page that demarcates which components should be processed by the Force.com server when an ajax request is generated.
Similarities:
Both action support and function can be used to call a controller method using an AJAX request.
Differences:
1. Action function can call the controller method from java script.
2. Action support adds AJAX support to another visualforce component and then call the controller method.
for example:
<apex:outputpanel id=”outptpnl”>
<apex:outputText value=”click here”/>
<apex:actionSupport event=”onclick” action=”{!controllerMethodName}” rerender=”pgblck” />
</apex:outputpanel>
Here action support adds AJAX to output panel, so once you click on output panel controller method will be called.3. Action function cannot add AJAX support to another component. But from a particular component which has AJAX support(onclick, onblur etc) action function can be called to call the controller method.
Example:
<apex:actionFunction name=”myactionfun” action=”{!actionFunMethod}” reRender=”outptText”/>
<apex:inputcheckbox onclick=”myactionfun” />
In this example onlick of input checkbox “myactionfun” action function is called from where controller method “actionFunMethod” gets called.Apart from this, the main difference between the “two” action support and action function is that, the action function can also be called from java script.
Example:
<apex:actionFunction name=”myactionfun” action=”{!actionFunMethod}” reRender=”outptText”/>
<apex:inputcheckbox onclick=”myJavaMethod()” />
<script>
function myJavaMethod(){
myactionfun();// this call the action function
}
</script>Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:47 PM in reply to: What is difference between Action support and Action function in salesforce?Hi,
Hi,
apex:ActionFunction : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
<apex:actionFunction name=”sendEmail” action=”{!sendEmailFunction}”></apex:actionFunction>
apex:ActionSupport : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.
<apex:outputpanel id=”counter”>
<apex:outputText value=”Click Me!: {!count}”/>
<apex:actionSupport event=”onclick” action=”{!incrementCounter}” rerender=”counter” status=”counterStatus”/>
</apex:outputpanel>Hope his helps.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:46 PM in reply to: What is the difference between Action support and Action function in Salesforce?Hi,
apex:ActionFunction : This component helps to envoke AJAX request (Call Controllers method) directly from Javascript method. It must be child of apex:form.
<apex:actionFunction name=”sendEmail” action=”{!sendEmailFunction}”></apex:actionFunction>
apex:ActionSupport : This component adds Ajax request to any other Visualforce component. Example : Commandlink button has inbuilt AJAX functionality however few components like OutputPanel does not have inbuilt AJAX capabilities. So with the help of this component, we can enable AJAX.
<apex:outputpanel id=”counter”>
<apex:outputText value=”Click Me!: {!count}”/>
<apex:actionSupport event=”onclick” action=”{!incrementCounter}” rerender=”counter” status=”counterStatus”/>
</apex:outputpanel>Hope his helps.
-
Hi,
So escalation means – reassigning to another person at a higher level or the same level in cases where the case remains dormant for a given period of time and are not looked upon by any Support Representatives or in cases where the Support Representatives are not able to resolve it and hence may need to be escalated.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:42 PM in reply to: What happen if child have two master records and one is deleted?Hi,
Few important points (usually interview type Questions of salesforce ):
One Object can have only two Master-Detail relationships.
If we delete record A (First Master detail relationship is always primary) – then child record c will be deleted.
If we delete record B then in this case also child record C will be deleted.
If we delete record c then only C will be deleted , master record will not be deleted.
If child C has two Master record A and B, Where A is primary relation then Child record C will inherit the look and feel of Parent object A.Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:39 PM in reply to: What is the use of apex:detail component in Salesforce?Hi,
To understand it more here is the example -
<!-- For this example to render properly, you must associate the Visualforce page
with a valid account record in the URL.
For example, if 001D000000IRt53 is the account ID, the resulting URL should be:
https://Salesforce_instance/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. --><apex:page standardController="Account">
<apex:detail subject="{!account.ownerId}" relatedList="false" title="false"/>
</apex:page>Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:36 PM in reply to: What are the different types of Exceptions in Salesforce?Hi,
AsyncException
Any problem with an asynchronous operation, such as failing to enqueue an asynchronous call.
CalloutException
Any problem with a Web service operation, such as failing to make a callout to an external system.
DmlException
Any problem with a DML statement, such as an insert statement missing a required field on a record.
EmailException
Any problem with email, such as failure to deliver. For more information, see Outbound Email.
ExternalObjectException
Any problem with external object records, such as connection timeouts during attempts to access the data that’s stored on external systems.
InvalidParameterValueException
An invalid parameter was supplied for a method or any problem with a URL used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
LimitException
A governor limit has been exceeded. This exception can’t be caught.
JSONException
Any problem with JSON serialization and deserialization operations. For more information, see the methods of System.JSON, System.JSONParser, andSystem.JSONGenerator.
ListException
Any problem with a list, such as attempting to access an index that is out of bounds.
MathException
Any problem with a mathematical operation, such as dividing by zero.
NoAccessException
Any problem with unauthorized access, such as trying to access an sObject that the current user does not have access to. This is generally used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
NoDataFoundException
Any problem with data that does not exist, such as trying to access an sObject that has been deleted. This is generally used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
NoSuchElementException
This exception is thrown if you try to access items that are outside the bounds of a list. This exception is used by the Iterator next method. For example, ifiterator.hasNext() == false and you call iterator.next(), this exception is thrown. This exception is also used by the Apex Flex Queue methods and is thrown if you attempt to access a job at an invalid position in the flex queue.
NullPointerException
Any problem with dereferencing null, such as in the following code:1
String s;
s.toLowerCase(); // Since s is null, this call causes
// a NullPointerException
QueryException
Any problem with SOQL queries, such as assigning a query that returns no records or more than one record to a singleton sObject variable.
RequiredFeatureMissing
A Chatter feature is required for code that has been deployed to an organization that does not have Chatter enabled.
SearchException
Any problem with SOSL queries executed with SOAP API search() call, for example, when the searchString parameter contains less than two characters. For more information, see the SOAP API Developer Guide.
SecurityException
Any problem with static methods in the Crypto utility class. For more information, see Crypto Class.
SerializationException
Any problem with the serialization of data. This is generally used with Visualforce pages. For more information on Visualforce, see the Visualforce Developer's Guide.
SObjectException
Any problem with sObject records, such as attempting to change a field in an updatestatement that can only be changed during insert.
StringException
Any problem with Strings, such as a String that is exceeding your heap size.
TypeException
Any problem with type conversions, such as attempting to convert the String 'a' to an Integer using the valueOf method.
VisualforceException
Any problem with a Visualforce page. For more information on Visualforce, see the Visualforce Developer's Guide.
XmlException
Any problem with the XmlStream classes, such as failing to read or write XML.The following is an example using the DmlException exception:
Account[] accts = new Account[]{new Account(billingcity = 'San Jose')};
try {
insert accts;
} catch (System.DmlException e) {
for (Integer i = 0; i < e.getNumDml(); i++) {
// Process exception here
System.debug(e.getDmlMessage(i));
}
}Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:26 PM in reply to: Can we call a Future method from Salesforce batch class?Hi,
To make it more simple -
You can't call asynchronous method from another asynchronous method.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:24 PM in reply to: How to handle an internal server error in Salesforce?Hi,
When we are working in super-complicated code implementations, we see this: An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:22 PM in reply to: What is the reason for “Object cannot be Deleted” error?Hi,
You need to see your debug log because it is generic UI error.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 5:15 PM in reply to: What is database.getQuerylocator in Salesforce?Hi,
Database.QueryLocator object when you are using a simple query (SELECT) to generate the scope of objects used in the batch job. If you use a querylocator object, the governor limit for the total number of records retrieved by SOQL queries is bypassed but we can retrieve up to 10,000 records.
To add more -
Database.query():
We can retrieve up to 50,000 records.
If VF page has read-only attribute, use Database.getQueryLocator().
In Batch Apex, if we use Database.query(), it supports 50,000 records only.String fieldName = ‘Name,Phone’;
String dynQuery = ‘select Id ‘ + fieldName + ‘ From Account’;
Database.query(dynQuery);Hope this helps.
-
Hi,
The lightning framework follows “Component-Based Architecture”, but it is based on web standards like (JS, HTML5, CSS3) and usesMVC/event-driven programming techniques.
To add more -
It’s beneficial to understand that Lightning Components are object oriented in nature, and have similar behavior to and characteristics of classes. Components have encapsulated presentation (markup), data state (attributes), logic (JavaScript functions), and style (CSS rules).
The public interface (or shape) is represented by a component’s attributes, which are analogous to member variables of a class. Each attribute is declared with a data type for the value it will reference, and may be accessed from within the component’s markup or encapsulated JavaScript.
Lightning Attributes, which are expressed as tags in a component’s markup, have a collection of available named attributes such as name, type, description, required and access. That last one determines the attribute’s scope, acting as an access modifier with the values public (the default), private, or global.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 3:47 PM in reply to: What are component Naming Rules in Salesforce Lightning?Hi,
To add more -
I prefer using a Application name as prefix and follow the component specification .Lets say my application name is "Chat" .Then i would name my components as below
"chatcmp.cmp"
"chatcontroller.js"
"chatHelper.js"
"chatevent.evt"
"chatSVG.SVG"
Naming convention should be based on component functionality to make it easier to locate the components .
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 3:44 PM in reply to: Is it mandatory requirement to have namespace to create Lightning components?Hi,
Every component is part of a namespace, which is used to group related components together. If your organization has a namespace prefix set, use that namespace to access your components. Otherwise, use the default namespace to access your components.
Another component or application can reference a component by adding <myNamespace:myComponent> in its markup. For example, the helloWorld component is in the docsample namespace. Another component can reference it by adding <docsample:helloWorld /> in its markup.Lightning components that Salesforce provides are grouped into several namespaces, such as aura, ui, and force. Components from third-party managed packages have namespaces from the providing organizations.
In your organization, you can choose to set a namespace prefix. If you do, that namespace is used for all of your Lightning components. A namespace prefix is required if you plan to offer managed packages on the AppExchange.
If you haven’t set a namespace prefix for your organization, use the default namespace c when referencing components that you’ve created.
Hope it helps.
-
shariq
MemberSeptember 16, 2018 at 3:43 PM in reply to: Is it a mandatory requirement to have a namespace to create Lightning components?Hi,
Every component is part of a namespace, which is used to group related components together. If your organization has a namespace prefix set, use that namespace to access your components. Otherwise, use the default namespace to access your components.
Another component or application can reference a component by adding <myNamespace:myComponent> in its markup. For example, the helloWorld component is in the docsample namespace. Another component can reference it by adding <docsample:helloWorld /> in its markup.Lightning components that Salesforce provides are grouped into several namespaces, such as aura, ui, and force. Components from third-party managed packages have namespaces from the providing organizations.
In your organization, you can choose to set a namespace prefix. If you do, that namespace is used for all of your Lightning components. A namespace prefix is required if you plan to offer managed packages on the AppExchange.
If you haven’t set a namespace prefix for your organization, use the default namespace c when referencing components that you’ve created.
Hope it helps.
-
shariq
MemberSeptember 16, 2018 at 3:40 PM in reply to: Why is it necessary for most sales teams to use both Leads and Contacts?Hi,
To make it more clear -
Once you convert the lead, the lead record is no longer accessible via the UI. So to access any of the personal contact information that was captured on lead records, sales team use the contact record.
Hope this helps.
-
Hi,
To authenticate using OAuth, you must create a connected app that defines your application’s OAuth settings for the Salesforce organization.
When you develop an external application that needs to authenticate with Salesforce, you need to define it as a new connected app within the Salesforce organization that informs Salesforce of this new authentication entry point.Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 3:37 PM in reply to: What is the list of tools are available in Salesforce Lightning?Hi,
Browser: Google Chrome
Many web app developers use Google Chrome because of its excellent developer tools. If that describes you, you’re done. Next item.If not, plan to switch to Chrome for Lightning components development. We’ll cover why in the next two items.
Browser Debugger: Chrome DevTools
If you’re not already confident using Chrome DevTools, we highly, highly recommend the outstanding docs available. Start with Getting Started, and then move to the training, beginning with DevTools Overview. Every minute you spend learning to use DevTools is 10 minutes you’ll save later. (The payoff is more like 50-to-1, but we’ll be conservative.)Yes, Firefox and Safari also have pretty good developer tools. But you’re switching anyway, because of the next item.
DevTools Extension: Salesforce Lightning Inspector
Developing for Lightning components without the Salesforce Lightning Inspector is like starting a fire by rubbing sticks together. You can do it, but it’s exercise, and who wants that?What’s special about the Lightning Inspector? With this plug-in for DevTools, you can navigate the component tree, inspect component attributes, and profile component performance. You can observe and inspect calls to server-side actions and their responses. And it helps you understand the sequence of event firing and handling. (We explain all these terms in the next module on this trail, Lightning Component Core Concepts.)
These are critical tasks when you’re developing anything more complicated than hello world. Yes, you can do it manually with any decent JavaScript developer tool, but it’s not simple. The Lightning Inspector makes it easy, which is the difference between a painful developer experience and a pleasurable one.
Editor: Force.com IDE
Salesforce offers two editors with dedicated tooling for Lightning components. While the Developer Console is fine for quick edits and small scale learning projects, including this module, it’s not the best tool for developing real components and apps.The best tool is the Force.com IDE, which adds dedicated navigation, syntax highlighting, and other Lightning components-specific features to the Eclipse IDE. The combination gives you a world-class development environment for Lightning components work.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 3:35 PM in reply to: Is it important to include @isTest on Testing Method in Salesforce? Explain?Hi,
First what is @isTest annotation -
Use the @isTest annotation to define classes and methods that only contain code used for testing your application. The@isTest annotation on methods is equivalent to the testMethod keyword. The @isTest annotation can take multiple modifiers within parentheses and separated by blanks.
Classes and methods defined as @isTest can be either private or public. Classes defined as @isTest must be top-level classes.
@isTest
private class MyTestClass {// Methods for testing
@isTest static void test1() {
// Implement test code
}@isTest static void test2() {
// Implement test code
}}
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 3:33 PM in reply to: Define the terms API, API key and API id in Salesforce with an example?Hi,
In simple language -
API - application programming interface, A set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service.
API key - An application programming interface key (API key) is a unique code that is passed in to an application programming interface (API) to identify the calling application or user. API keys are used to track and control how the API is being used, for example to prevent malicious use or abuse of the API.
Hope this helps.
-
Hi,
You can't disable it by yourself but I think you need to talk to salesforce support for disabling this feature.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 1:40 PM in reply to: Can a trigger call a batch class in Salesforce?Hi,
Yes but it is not the best practice, there are limits in salesforce, so better is to change your logic and try something else.
Hope this helps.
-
shariq
MemberSeptember 16, 2018 at 1:38 PM in reply to: How is Trigger.New different from Trigger.newMap in Salesforce?Hi,
To understand it more simple -
Trigger.new - it return the list of sobject's records.
Trigger.newMap - It returns the map of Id vs sobject record.
Hope it helps.
-
shariq
MemberSeptember 16, 2018 at 1:36 PM in reply to: While implementing SOAP API integration, why session id "Session_ID_Remove" is shown in debug?Hi,
In earlier version it was shown in debugs, but for security reasons salesforce has removed this functionality. Best way is to save the session id in custom setting and use it from there.
Hope this helps.
-
Hi,
Savepoint and roll back will help us to create your own transcation. Suppose you have written long code which contains many more DML statement, at the some point you will want this DML statement should not be executed, you may need to modify your code, at that time you will have to return that point, savepoint will identifies that point , Rollback will restore the database to that point(savepoint).
Here is some code you can refer
Account a = new Account(Name = 'xxx'); insert a;
System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
AccountNumber);// Create a savepoint while AccountNumber is null
Savepoint sp = Database.setSavepoint();// Change the account number
a.AccountNumber = '123';
update a;
System.assertEquals('123', [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
AccountNumber);// Rollback to the previous null value
Database.rollback(sp);
System.assertEquals(null, [SELECT AccountNumber FROM Account WHERE Id = :a.Id].
AccountNumber);Hope this helps.