Parul
IndividualForum Replies Created
-
Parul
MemberSeptember 21, 2018 at 1:48 pm in reply to: What is the use of optOutPolicy while sending email using apex through SingleEmailMessage()?It helps a lot.
Thanks
-
Parul
MemberSeptember 21, 2018 at 1:47 pm in reply to: Is it possible to do synchronous web service callouts from scheduled apex in Salesforce?I think synchronous web service callouts from scheduled apex is able to make callouts make an asynchronous callout by placing the callout in method annotated with @future(callout=true).
THanks
-
Parul
MemberSeptember 21, 2018 at 1:43 pm in reply to: How to handle error records in Batch apex in Salesforce?Hi
Some things to do:
Have your batch class implement Database.stateful
Declare some variables that are initialized in the constructor to 0. These variables count successes and errors; also a string variable that remembers the records that failed and why (initialized to empty string).
Use Database.update with allOrNothing = false instead of update within execute(). Interrogate each member of Database.SaveResult[] for isSuccess() and count succcesses and failures in your stateful variables from #2. Log in the stateful variable all the errors (id of record, name of record, and error message/exception)
In the finish method, send an email to the sysad of count of successes/failures + string variable of all the failures.
In finish() method, write your batch results to a custom Log__c record(s)Thanks
-
Parul
MemberSeptember 21, 2018 at 1:41 pm in reply to: What are the different things which we need to consider while using future methods in Salesforce?hI
To avoid adding large numbers of future methods to the asynchronous queue, if possible. If more than 2,000 unprocessed requests from a single organization are in the queue, any additional requests from the same organization will be delayed while the queue handles requests from other organizations.
Future methods cannot call by batch class.
Thanks
-
Parul
MemberSeptember 21, 2018 at 1:36 pm in reply to: How can we use regex for searching in datatable in Salesforce?hi
Try this code snippet:
As an alternative approach you could try to use a custom filter :
$('#search-inp').keyup(function() {
var str,
term = $(this).val(),
regexp = new RegExp('\\b' + term + '\\b', 'ig');removeHighlight();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex ) {
str = data[1];
return regexp.test(str) ? true : false;
}
);
table.draw();
highlight(term);
$.fn.dataTable.ext.search.pop();
})Thanks
-
Parul
MemberSeptember 21, 2018 at 1:29 pm in reply to: Is there any limit of records to be inserted in map used to stored data in batch class?Hi
Yes, the limit is 10,000 records to be inserted per transaction.
Thanks
-
Parul
MemberSeptember 21, 2018 at 1:19 pm in reply to: How can we find the unused method in apex class?Hi,
The Tooling API can be used to retrieve the SymbolTable for each apex class. This Symbol Table will tell you the methods that are defined in the apex class, and the references to methods that are consumed in the externalReferences.
By scanning the methods and corresponding references in each apex classes symbol table you can find methods that aren’t called by other apex classes.
Happily, Andrew Fawcett has already made such a tool as a canvas app. See Spring Cleaning Apex Code with the Tooling API.
Note, as this is only scanning the apex classes it won’t detect declarative references from Visualforce markup.
Thanks
-
Parul
MemberSeptember 21, 2018 at 1:18 pm in reply to: How to attach file using Salesforce Lightning for Salesforce1?Hi,
For this Please use base64 encoding .
1.Use JavaScript’s FileReader’s readAsDataURL to read the file selected by the file input into a String variable.
2.Encode the contents using JavaScript’s encodeURIComponent function.
3.Call the @AuraEnabled action with the contents, content type, and the Id of the parent record.
4.URI decode the contents.
5.Base64 decode the contents.
6.Insert the attachment.Thanks
-
Parul
MemberSeptember 21, 2018 at 1:16 pm in reply to: How to swap 2 different component views in Salesforce Lightning?Hi,
Lightning event is best way communicate between two components.So for this,Please use lightning event.
Below are the steps for these type of scenario:
1.Create a main component which will be use as container for two components.
2.Let suppose you want to swap from component A to component B.First create view for component A in main component.
3.When you want to swap from component A to B fire an event from A that will be handled bu main component.
4.Main component will destroy component A and will create Component B.Thanks
-
Parul
MemberSeptember 21, 2018 at 1:02 pm in reply to: Ways Sales Cloud PRM helps you optimize the partner life cycle.hi
7 WAYS TO IMPROVE A CHANNEL PARTNER’S SALES PRODUCTIVITY WITH PRM
As the person responsible for your channel partner relationships, you are always looking for ways to help your partners increase their sales effectiveness. You have a singular focus on driving sales (with maybe a secondary focus on margin improvement) and you are interested in any tools that help.
1. Quick and efficient on-boarding of new partners
2. Ability to ramp-up new sales people quickly
3. Lead Registration processes to avoid Channel Conflict
4. Robust Training and Certification Tools
5. Marketing & Communications Support
6. Efficient process around new product introductions
7. Access to Performance Management Tools
Thanks
-
Parul
MemberSeptember 21, 2018 at 12:57 pm in reply to: When do we run the tests synchronously and when asynchronously in test classes ?hi
ASYNCHRONOUS EXAMPLE. In solving many engineering problems, the software is designed to split up the overall problem into multiple individual tasks, and then execute them asynchronously. Inverting a matrix, or a finite element analysis problem, are good examples. In computing, sorting a list is an example. The quick sort routine, for example, splits the list into two lists, and sorts each of them by calling itself recursively. In both of the above examples, the two tasks can (and often were) executed asynchronously. They do not need to be on separate threads. Even a machine with one CPU, and only one thread of execution can be coded to initiate processing of a second task before a first one has completed. The only criterion is that the results of one task are not necessary as inputs to the other task. As long as the start and end times of the tasks overlap, (possible only if the output of neither is needed as inputs to the other), they are being executed asynchronously, no matter how many threads are in use.
SYNCHRONOUS EXAMPLE. Any process consisting of multiple tasks where the tasks must be executed in sequence, but one must be executed on another machine (Fetch and/or update data, get a stock quote from a financial service, etc.). If it's on a separate machine it is on a separate thread, whether synchronous or asynchronous.
THanks
-
Parul
MemberSeptember 21, 2018 at 12:33 pm in reply to: Explain the uses of lightning:formattedNumber in Salesforce.A lightning:formattedNumber component displays formatted numbers for decimals, currency, and percentages. This component uses the Intl.NumberFormat JavaScript object to format numerical values. The locale set in the app’s user preferences determines how numbers are formatted.
The component has several attributes that specify how number formatting is handled in your app. Among these attributes are minimumSignificantDigits and maximumSignificantDigits. Significant digits refer the accuracy of a number. For example, 1000 has one significant digit, but 1000.0 has five significant digits. Additionally, the number of decimal places can be customized using maximumFractionDigits.
Decimal numbers default to 3 decimal places. This example returns 1234.568.
Thanks
-
Parul
MemberSeptember 21, 2018 at 12:13 pm in reply to: How can we convert Lead to Account through apex code?When there is a chance of further negotiations with a lead, it can be converted into an account, contact,optionally an opportunity. In short, once the lead status has reached a certain stage, it can be qualified as a potential. On conversion, all the lead details are transferred in creating an account, contact and optionally an opportunity. The lead conversion process is a manual process, if you want to automate it then you have to use Apex code. This article will help you to understand how to automate lead conversion process using the Process Builder.
Now, we have to understand a new Apex annotation i.e. @InvocableMethod. This annotation lets us use an Apex method as being something that can be call from somewhere other than Apex. The AutoConvertLeadsclass contains a single method that is passing the ids of the Leads whose Rating changed to Hot. Create the following class in your organization.
Public class AutoConvertLeads
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
Database.LeadConvert Leadconvert = new Database.LeadConvert();
Leadconvert.setLeadId(LeadIds[0]);
LeadStatus Leads= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
Leadconvert.setConvertedStatus(Leads.MasterLabel);
Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
System.assert(Leadconverts.isSuccess());
}
} -
esources can be archives (such as .zip and .jar files), images, stylesheets, JavaScript, and other files.
Static resources are managed and distributed by Lightning Platform, which acts as a content distribution network (CDN) for the files. Caching and distribution are handled automatically.A single static resource can be up to 5 MB in size. An organization can have up to 250 MB of static resources. Static resources apply to your organization’s quota of data storage.
Thanks.
-
Parul
MemberSeptember 21, 2018 at 12:07 pm in reply to: How to set the Login hours and Login IP ranges to the users in Salesforce?hi
To set the login hours and login IP ranges to users in Salesforce, follow these steps:
From Setup, enter Profiles in the Quick Find box, then select Profiles.
Select a profile and click its name.
In the profile overview page, click Login IP Ranges.
Specify allowed IP addresses for the profile.Thanks
-
Parul
MemberSeptember 21, 2018 at 11:54 am in reply to: Is it necessary to define an explicit primary key in custom objects?There is not necessary that every object has a standard field called id. There is no need to define an explicit primary key in custom objects. The standard id field can be used as primary key.
-
Parul
MemberSeptember 21, 2018 at 11:50 am in reply to: What are the Escalation Rules in Salesforce?Escalation rules are used to escalate cases automatically when they meet the criteria which are defined in rule entry. We create rule entries where criteria is defined to escalate a case. Whenever an escalation rule is applied for a case, it checks whether the criteria met with the rule entry
Thanks
-
Parul
MemberSeptember 21, 2018 at 11:41 am in reply to: What is recursion problem in Salesforce Trigger? How to troubleshoot it?Solution for this kind of scenario
And set this boolean variable in your trigger and then set this boolean variable to false as done in the trigger below.
trigger ContactTriggers on Contact (after update)
{
Set<String> accIdSet = new Set<String>();
if(ContactTriggerHandler.isFirstTime)
{
ContactTriggerHandler.isFirstTime = false;
for(Contact conObj : Trigger.New)
{
if(conObj.name != 'Test')
{
accIdSet.add(conObj.accountId);
}
}
// any code here
}
}Trigger:
-
Parul
MemberSeptember 21, 2018 at 11:40 am in reply to: What is recursion problem in Salesforce Trigger? How to troubleshoot it?Avoiding Recursive Triggers:
Recursion occurs when the same code is executed again and again. It can lead to an infinite loop and which can result in governor limit sometime. Sometime it can also result in unexpected output.
It is very common to have recursion in the trigger which can result in unexpected output or some error. So we should write code in such a way that it does not result to recursion. But sometime we are left with no choice.
For example, we may come across a situation where in a trigger we update a field which in result invoke a workflow. The workflow contains one field update on the same object. So trigger will be executed two times. It can lead us to unexpected output.
Another example is our trigger fires on after update, and it updates some related object, and there is one more trigger on a related object which updates child object. So it can result from too infinite loop.
To avoid the situation of the recursive call, make sure your trigger is getting executed only one time. To do so, you can create a class with a static boolean variable with default value true.
In the trigger, before executing your code keep a check that the variable is true or not.
Once you check to make the variable false.
As an example let says you have the following trigger on contact:
trigger recursiveTrigger on Contact (after update) {
Id recordId ;
for(contact con : trigger.new){
recordId = con.id;
}
Contact conRec =[select id,name,email from contact where id !=: recordId limit 1];conRec.email = '[email protected]';
update conRec;
}
}thanks.
-
Parul
MemberSeptember 21, 2018 at 11:35 am in reply to: What do you mean by idempotent operation in Salesforce REST API?From a RESTful service standpoint, for an operation (or service call) to be idempotent, clients can make that same call repeatedly while producing the same result. In other words, making multiple identical requests has the same effect as making a single request. Note that while idempotent operations produce the same result on the server (no side effects), the response itself may not be the same (e.g. a resource’s state may change between requests).
The PUT and DELETE methods are defined to be idempotent. However, there is a caveat on DELETE. The problem with DELETE, which if successful would normally return a 200 (OK) or 204 (No Content), will often return a 404 (Not Found) on subsequent calls, unless the service is configured to “mark” resources for deletion without actually deleting them. However, when the service actually deletes the resource, the next call will not find the resource to delete it and return a 404. However, the state on the server is the same after each DELETE call, but the response is different.
Thanks.
-
Parul
MemberSeptember 21, 2018 at 11:33 am in reply to: Why do we need Security Token in Salesforce?hi
Purpose of the token is to improve the security between Salesforce users and Salesforce.com. when accessing Salesforce via API, [password][security token] should be given to login. The purpose of the token is to improve the security between Salesforce users and Salesforce.com in the case of a compromised account. It ensures, among other things, that if a user’s account credentials are compromised.
Thanks
-
Parul
MemberSeptember 21, 2018 at 11:31 am in reply to: How to use same Report on multiple dashboard components in Salesforce?HI
You can use the same report in multiple dashboard components on a single dashboard (e.g., use the same report in both a bar chart and pie chart).
Thanks
-
Parul
MemberSeptember 21, 2018 at 11:25 am in reply to: What is Macros in Salesforce Case Automation?Hi
Support agents use macros to automate common repetitive tasks so that they can spend more time working with customers and solving customer issues. Macros speed up agent productivity by increasing consistency when communicating with customers and streamlining agent workflows. For example, suppose a customer emails an agent with a question about the company’s return policy. The agent can reply to the customer email within the case by running a macro that inserts quick text containing the return policy into the email reply. The agent doesn’t worry about forgetting an important detail, such as returns are only accepted within 45 days of purchase, because the macro inserts the right quick text.
thank
-
Hi
If you’re a Data.com List User, your name also appears in the Data.com List User section of the page. After you’ve used your monthly record additions, you’ll share record additions from a pool with all other List Users in your organization. Your organization’s pool has a limit, so if one Data.com List User reaches the limit, other Data.com List Users can’t add records. List pools expire one year after purchase.
If adding a set of records causes you to exceed your addition limit, you’ll see a message that tells you how many additions you have remaining. If you still need to add more records, contact your administrator.
Thanks
-
Parul
MemberSeptember 21, 2018 at 10:46 am in reply to: What is the difference between http methods PUT and POST in Salesforce?Adding some point
The fundamental difference between the POST and PUT requests is reflected in the different meaning of the Request-URI. The URI in a POST request identifies the resource that will handle the enclosed entity. That resource might be a data-accepting process, a gateway to some other protocol, or a separate entity that accepts annotations. In contrast, the URI in a PUT request identifies the entity enclosed with the request -- the user agent knows what URI is intended and the server MUST NOT attempt to apply the request to some other resource. If the server desires that the request be applied to a different URI, it MUST send a 301 (Moved Permanently) response; the user agent MAY then make its own decision regarding whether or not to redirect the request.
Thanks