Anurag algoworks
IndividualForum Replies Created
-
Anurag
MemberAugust 28, 2018 at 1:35 pm in reply to: What is Time-dependent workflow and its limitations in Salesforce?Hi Prachi,
Salesforce users have an option to Monitor their time based workflow actions pending in the queue. In order to do that, they can follow these steps:
1.From Setup, enter Time-Based Workflow in the Quick Find box, then select Time-Based Workflow.
2.Click Search to view all pending actions for any active workflow rules, or set the filter criteria and click Search to view only the pending actions that match the criteria.
Disadvantage:
Time based workflow actions will not always execute at the exact time displayed in the Monitoring setup menu.Instead, they are batched and executed every 15 minutes. Considerations for Time-Dependent Actions and Time Triggers still apply. Therefore the expectation for the execution of time based workflow actions should be within 15 minutes of the scheduled time unless the Time Trigger per hour limit is exceeded, which will push the batch to the next hour.
-
Anurag
MemberAugust 28, 2018 at 12:44 pm in reply to: How to return all users that have access to a specific record in Salesforce?Hi Anjali,
You can use userRecordAccess object to check CRUD permissions..
So pass the recordId and userId.. to check that user having what type of access on that record..
you can check variables like HasDeleteAccess. If HasDeleteAccess true means user have delete access. If false then user don't have access..
Based on these accessibility perform DML..
List<UserRecordAccess> lstUserRecordAccess = [SELECT RecordId,MaxAccessLevel,HasAllAccess,
HasDeleteAccess,
HasEditAccess,
HasReadAccess,
HasTransferAccess
FROM UserRecordAccess
WHERE UserId = '00550000000rlrX'
AND RecordId = '0015000000TaWdI']; -
Anurag
MemberAugust 27, 2018 at 2:40 pm in reply to: What is the solution for error "System.LimitException: Too many Email Invocations: 11" in Salesforce?Hi Shradha,
To fix this, you can create a Batch Apex Class that your Schedule Apex invokes. Move the Send Email logic inside your Batch Apex class and scope the batch so that is only processes 10 contacts at a time.Try this link:
-
Anurag
MemberAugust 24, 2018 at 1:46 pm in reply to: What reduce(function) will do in component.find() in Salesforce Lightning?Hi Anjali,
reduce function is part of array prototype javascript object. It takes a function as input and applies that on the array and returns the output.
The reduce() method applies a function against an accumulator and each element in the array (from left to right) to reduce it to a single value.
var total = [0, 1, 2, 3].reduce(function(sum, value) {
return sum + value;
}, 0);
// total is 6 -
Anurag
MemberAugust 24, 2018 at 6:34 am in reply to: What is the difference between “printable View” and “Export Details” button on a report?Hi Chanchal,
The 'Printable View' of a report retains the format and summary information of a report. This includes Custom Summary Formula fields.
The 'Export Details' to Excel option will produce only the detail rows. With only the detail rows available, the exported file is raw data that is easily modifiable. This also allows for a smoother import.
The fields used as grouping for summary format reports will also be placed as the last column in excel once the report is exported via Export details hence any report will be rendered as tabular report.
-
Anurag
MemberAugust 23, 2018 at 3:04 pm in reply to: How to convert string date format in Salesforce Apex?Hi Shradha,
Here is the way to do it:
String TimeString = '4:33:34 PM';
String Regex = '(\\d{1,2}):(\\d{1,2}):(\\d{1,2}) ([PA]M)';
Pattern p = Pattern.compile( Regex );
Matcher m = p.matcher( TimeString );if ( m.matches() ){
Integer Hours = Integer.valueOf( m.group(1) )
, Minutes = Integer.valueOf( m.group(2) )
, Seconds = Integer.valueOf( m.group(3) )
, PmShift = m.group(4) == 'PM' ? 12 : 0
;Time t = Time.newInstance( Hours + PmShift , Minutes , Seconds , 0 );
System.debug( (''+t).substring(0,(''+t).indexOf('.')) );
} -
Anurag
MemberAugust 21, 2018 at 1:43 pm in reply to: How to handle error records in Batch apex in Salesforce?Hi Madhulika,
Things you can 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)
-
Anurag
MemberAugust 21, 2018 at 1:41 pm in reply to: Explain what is the limit of data.com records that can be added to Salesforce?Hi Prachi,
From Setup, in the Quick Find box, enter Users and then select Prospector Users. In the Data.com Users section, find your name and see what your monthly limit is and how many records you’ve already added or exported during the month. Your administrator sets the monthly allowance, which expires at the end of each month, regardless of whether you’ve met your limit.
-
Anurag
MemberAugust 17, 2018 at 2:37 pm in reply to: What is the difference between Recursive Trigger and Circular Trigger in Salesforce?Hi Madhulika,
If a trigger is callled again and again than it is called recursive trigger.
For Eg:
trigger on Contact (before update){
update anyContactList;
}In the above example we are updating contact list in before update trigger so it will again call the trigger and our trigger will be called recursively till we stop or block it with the help of a static variable.Circular and recursive triggers are basically same.
-
Anurag
MemberAugust 16, 2018 at 1:20 pm in reply to: What is rerender in Salesforce Lightning Component?Hi Prachi,
Rerender function will be called when a component’s value changes due to user action like a button click or some other event like component/application event. Rerender function updates component upon rerendering of the component.
-
Anurag
MemberAugust 16, 2018 at 1:17 pm in reply to: Can I find out if the current user has access to a record without querying?Hi Madhulika,
To find out if a particular user has Edit access to a record, use the UserRecordAccess object. This object is available in API version 24.0 and later. You can use SOQL to query this object to find out if the user has edit access to the record in question.
-
Anurag
MemberAugust 14, 2018 at 2:23 pm in reply to: What are the types of Email Templates in Salesforce?Hi Madhulika,
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.
-
Anurag
MemberAugust 14, 2018 at 2:21 pm in reply to: Where variable value gets stored for a wrapper class in Salesforce?Hi Chanchal,
When you create a wrapper, you also create instance variables for all the variables you define in your class (isDisplayed, isSelected). These are all different objects, even if you have two instances of the same class. They will contain different data between two instances of the same class.
-
Anurag
MemberAugust 14, 2018 at 2:20 pm in reply to: What is a use case for Salesforce Connect in Salesforce?Hi Suniti,
Salesforce Connect is a framework that enables you to view, search, and modify data that’s stored outside your Salesforce org. For example, perhaps you have data that’s stored on premises in an enterprise resource planning (ERP) system. Instead of copying the data into your org, you can use external objects to access the data in real time via web service callouts.
Salesforce Connect lets your Salesforce org access data from a wide variety of external systems. You can integrate tables from SAP® NetWeaver Gateway, Microsoft Dynamics® NAV, and many other data sources in real time without writing a single line of code. Previously, the only way to integrate external data with Salesforce was to use extract, transform, and load (ETL) tools. That process is time consuming and requires you to copy data into your org that you might never use or quickly becomes stale. In contrast, Salesforce Connect maps data tables in external systems to external objects in your org.
-
Anurag
MemberAugust 13, 2018 at 2:12 pm in reply to: Can we create Master-Detail relationship on existing records in Salesforce?Hi Sanjana,
You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail.
-
Anurag
MemberAugust 13, 2018 at 2:10 pm in reply to: Why does validation rule not work when we update workflow field?Hi Madhulika,
Validation Rules fire before workflow rules, so the record has to meet the validation rule criteria before the workflows get a chance to run.
-
Anurag
MemberAugust 10, 2018 at 3:41 pm in reply to: When we can’t add Time-dependent action in Workflow rule in Salesforce?Hi Chanchal,
You can’t add time-dependent actions to a rule if you choose Every time a record is created or edited.
-
Anurag
MemberAugust 9, 2018 at 2:48 pm in reply to: What are the actions available in a Salesforce workflow?Hi Anjali,
Workflow rules can help automate the following types of actions based on your organization's processes:
Tasks: Assign a new task to a user, role, or record owner.
Email Alerts: Send an email to one or more recipients you specify.
Field Updates: Update the value of a field on a record.
Outbound Messages: Send a secure, configurable API message (in XML format) to a designated listener. -
Hi Prachi,
We need mapping (using 'map' collection) basically to map 2 things which can be anything i.e. sObject, primitive data types and even collections. But the advantage of using map is that it saves us from using the for loop.
Let us understand this by an example:
Suppose we have 10,000 Account records and we need to have a set of IDs of all those records.
Without Map:
List<account> acc = [select Id from account limit 10000] ;
set<id> accIds = new set<id>() ;
for(Account a: acc)
{
accIds.add(a) ;
}Thus, the loop runs 10000 times fetching us the required IDs.
With Map:
Map<id,account> m = new Map<id,account>([Select Name from Account limit 10000]);
Set<Id> s=m.keyset();
The query maps the Account Id with the field that we have passed (in this case- 'Name') in the variable 'm'.
Thus, we are saved with the tedious loop method.
-
Anurag
MemberAugust 8, 2018 at 12:47 pm in reply to: What are full copy and partial copy in salesforce?Hi Madhulika,
Full Copy and Partial Copy are the examples of various types of Sandbox that are available for use.
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.Full 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. -
Hi Chanchal,
The term bulkifying Apex code refers to the concept of making sure the code properly handles more than one record at a time. When a batch of records initiate Apex, a single instance of that Apex code is executed, but it needs to handle all of the records in that given batch. For example, a trigger could be invoked by an Force.com Web Services API call that inserted a batch of records. Or a custom Apex Web Service. So if a batch of records invokes the the same Apex code, all of those records need to be processed as a bulk, in order to write scalable code and avoid hitting governor limits.
Here is an example of poorly written code that only handles one record:
trigger accountTestTrggr on Account (before insert, before update) {
Account acct = Trigger.new[0];
List<Contact> contacts = [select id, salutation, firstname, lastname, email
from Contact where accountId = :acct.Id];}
-
Anurag
MemberAugust 8, 2018 at 12:31 pm in reply to: What is the difference between primitive type and wrapper class in Salesforce?Hi Chanchal,
Primitive data types are what the Salesforce provides to us by default.Some of the primitive data types are Integer,Float,Boolean etc.
Wrapper Class is a class which wraps several primitive data types to form a single class which we use to perform certain tasks.
-
Anurag
MemberAugust 3, 2018 at 1:56 pm in reply to: Is it possible to delete Junction Object in Salesforce Master-Detail Relationship?Hi Chanchal,
If the parent objects don’t have Roll up Summary fields for the child object then we can delete.To delete a child object it should not be referred to Apex Classes and Apex Triggers.Later if we undelete the object, Master-detail fields on the junction objects will be converted to look up Fields.
-
Anurag
MemberAugust 3, 2018 at 1:55 pm in reply to: What is the difference between Insert and Database.insert in Salesforce?Hi Chanchal,
Insert – Insert and Database.insert method are same but Database.insert method provide you more flexibility as compared to Insert Method. If there is any exception while making DML using insert then All records will be aborted.
Database.Insert – Using Database.Insert method you can specify whether you wanted to abort the complete records when there is an error in any records or commit the success record and show a list of failed records. It also provides the Rollback functionality.
-
Anurag
MemberJuly 31, 2018 at 1:44 pm in reply to: What is the use of the Static Resources in Salesforce?Hi Anjali,
Static resources allow you to upload content that you can reference in a Visualforce page. Resources 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.Static resources are referenced using the $Resource global variable, which can be used directly by Visualforce, or used as a parameter to functions such as URLFOR().