shariq
IndividualForum Replies Created
-
shariq
MemberSeptember 22, 2018 at 10:42 PM in reply to: In Which Sequence Trigger and Automation Rules run in Salesforce.com?The following is the order Salesforce logic is applied to a record.
Old record loaded from database (or initialized for new inserts)
New record values overwrite old values
System Validation Rules
All Apex “before” triggers
Custom Validation Rules
Record saved to database (but not committed)
Record reloaded from database
All Apex “after” triggers
Assignment rules
Auto-response rules
Workflow rules
Escalation rules
Parent Rollup Summary Formula value updated (if present)
Database commit
Post-commit logic (sending email)
Additional notes: There is no way to control the order of execution within each group above. -
shariq
MemberSeptember 22, 2018 at 10:38 PM in reply to: What is the controller extension in Salesforce?Any apex class having a public constructor with Custom Controller or Standard Controller object as a single argument is known as controller extension.
-
Dynamic Apex enables developers to create more flexible applications by providing them with the ability to “Access sObject and field describe information”, “Write Dynamic SOQL Queries”, “Write Dynamic SOSL Queries” and “Dynamic DML”.
-
shariq
MemberSeptember 22, 2018 at 10:36 PM in reply to: How to display error messages in Salesforce Visualforce Page?Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Required fields are missing. '));
in Visualforce page add below tag where you want to display the error message.<apex:pageMessages ></apex:pageMessages>
-
shariq
MemberSeptember 22, 2018 at 10:35 PM in reply to: How to create instance of Sobject dynamically if you don’t know which sobject is going to be instantiated?public SObject getNewSobject(String t)
{// Call global describe to get the map of string to token.
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();// Get the token for the sobject based on the type.
Schema.SObjectType st = gd.get(t);// Instantiate the sobject from the token.
Sobject s = st.newSobject();return s;
} -
shariq
MemberSeptember 22, 2018 at 10:33 PM in reply to: What is Scheduler class in Salesforce Apex and explain how to use Cron statement to Schedule Apex class?The Apex class which is programmed to run at a predefined interval.
Class must implement schedulable interface and it contains method named execute().
There are two ways to invoke schedular:
Using UI
Using System.scheduleThe class which implements interface schedulable get the button texted with “Schedule”, when user clicks on that button, new interface opens to schedule the classes which implement that interface.
To see what happened to the scheduled job, go to “Monitoring | Scheduled jobs ”Example of scheduling:
scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
system.schedule('Merge Job', sch, m); -
shariq
MemberSeptember 22, 2018 at 10:31 PM in reply to: What is the scope of static variable in Salesforce Apex?When you declare a method or variable as static, it’s initialized only once when a class is loaded. Static variables aren’t transmitted as part of the view state for a Visualforce page.
Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.
-
shariq
MemberSeptember 22, 2018 at 10:30 PM in reply to: What is the difference between database.insert and insert in Salesforce?insert is the DML statement which is same as databse.insert. However, database.insert gives more flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert by using the method setOptions(Database.DMLOptions)
Important Difference:If we use the DML statement (insert), then in bulk operation if error occurs, the execution will stop and Apex code throws an error which can be handled in try catch block.
If DML database methods (Database.insert) used, then if error occurs the remaining records will be inserted / updated means partial DML operation will be done.-
This reply was modified 7 years, 6 months ago by
shariq.
-
This reply was modified 7 years, 6 months ago by
-
shariq
MemberSeptember 22, 2018 at 10:28 PM in reply to: Can we convert the lookup relationship to Master Detail relationship in Salesforce?We can convert the lookup relationship to master detail relationship if and only if all the existing record has valid lookup field.
-
shariq
MemberSeptember 22, 2018 at 10:28 PM in reply to: What is Master Detail relationship and look up relationship in Salesforce?Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.
Look up relationship is something like “has-a” (Containership) relationship. Where one record has reference to other records. When one record is deleted then there is no impact on other records. -
shariq
MemberSeptember 22, 2018 at 10:27 PM in reply to: List the types of the custom settings in Salesforce?List Custom Settings:
A type of custom setting that provides a reusable set of static data that can be accessed across your organization. If you use a particular set of data frequently within your application, putting that data in a list custom setting streamlines access to it. Data in list settings does not vary with profile or user, but is available organization-wide. Examples of list data include two-letter state abbreviations, international dialing prefixes, and catalog numbers for products. Because the data is cached, access is low-cost and efficient: you don’t have to use SOQL queries that count against your governor limits.Hierarchy Custom Settings:
A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings. -
Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, Apex, and the Web services API.
-
It is used to set the context to current page, normally used for testing the visual force controller
-
Generally, all Apex code runs in system mode, and the permissions and record sharing of the current user are not taken into account. The system method, System.runAs(), lets you write test methods that change user contexts to either an existing user or a new user. All of that user’s record sharing is then enforced. You can only use runAs in a test method. The original system context is started again after all runAs() test methods complete.
-
shariq
MemberSeptember 22, 2018 at 10:23 PM in reply to: What is the difference between External ID and Unique ID in Salesforce?External ID
This is a field that usually references an ID from another (external) system. For instance, if the customer has an Oracle Financials system that they will be linking with salesforce.com, it may be easier for them to be able to refer to the Oracle ID of account records from within salesforce. So they would create an external ID in salesforce.com and they would load the Oracle ID into that field for each account. They can then refer to that ID field, rather than the salesforce.com id.Additionally, if you have an external ID field, the field becomes searchable in the sidebar search. You also can use the upsert API call with the extenal ID to refer to records.
You can have multiple records with the same external ID (though it is not reccomended, as it will defeat the purpose of the external id) .
External Id available for Text, Number and Email field types.
External Id is used in upsert operations.
If external id is absenor not matched then insert happens.
If external id matched once then record will be updated.
If external id is matched multiple times then error occurs.Unique ID field
This is a setting for the field that will prevent you from using the same value in multiple records for the unique field. So if I create a 5 character text field and make it unique, and I create a record with the value “12345” I will not be able to create another record with that same value in the unique field. If i try to do so, I will get an error saying that the value is already in use.
Often, External Ids are set with the unique property so that the IDs will be unique to each record.
-
shariq
MemberSeptember 22, 2018 at 10:22 PM in reply to: Explain Permission sets released in Salesforce Winter 12.A permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles, but permission sets extend users’ functional access without changing their profiles. For example, to give users access to a custom object, create a permission set, enable the required permissions for the object, and assign the permission set to the users. You never have to change profiles, or create a profile for a single use case. While users can have only one profile, they can have multiple permission sets.
-
shariq
MemberSeptember 22, 2018 at 10:22 PM in reply to: Keyword “with sharing” runs in system mode then why keyword “without sharing” is introduced in Salesforce apex?Lets take example, there is classA declared using “with sharing” and it calls classB method. classB is not declared with any keyword then by default “with sharing” will be applied to that class because originating call is done through classA. To avoid this we have to explicitly define classB with keyword “without sharing”.
-
shariq
MemberSeptember 22, 2018 at 10:19 PM in reply to: What is Mandatory while creating User, Role or Profile in Salesforce?Its Profile.
-
shariq
MemberSeptember 22, 2018 at 10:18 PM in reply to: In OWD (Organization wide sharing), can i change the setting “Grant Access Using Hierarchies” for Standard Salesforce Objects?You cannot change it for Standard Objects However for Custom Objects its possible.
-
shariq
MemberSeptember 22, 2018 at 10:18 PM in reply to: If i want Object level access then what should i use from Salesforce Security Model?Use Profile
-
shariq
MemberSeptember 22, 2018 at 10:17 PM in reply to: If i want record level access then what should i use from Salesforce security model?Manual Sharing
-
shariq
MemberSeptember 22, 2018 at 10:17 PM in reply to: In Profile settings, what is difference between “Modify All Data” and “Modify All” in Salesforce?Modify All Data: Create, edit, and delete all organization data, regardless of sharing settings.
Modify All: Give Read, Add, Delete permission to selected Object, Create permission is not included in Modify All permission. -
shariq
MemberSeptember 22, 2018 at 10:13 PM in reply to: What is Difference between “Printable View” and “Export Details” button on Salesforce Report?Printable View: formatting, grouping and subtotals are persisted.
Export Details: formatting, grouping and subtotals are lost -
shariq
MemberSeptember 22, 2018 at 10:12 PM in reply to: While creating new profile for user, which existing profile should be copied in Salesforce?If the new user is not System administrator then copy from “Standard User” profile
-
shariq
MemberSeptember 22, 2018 at 10:12 PM in reply to: How to hide the “App Setup” Menu from user’s setup page in Salesforce?In Profile, remove access “View Setup and Configuration”.