Mass Email Messages
1. You can’t send a mass email using a Visualforce email template.
2. You can use list<id> not set<id> in mass email .
3. You can use only TargetObjectIds () not TargetobjectId() because TargetObjectid() use in single.email message.
4. VF template support only recipient type USER, CONTACT, LEAD.
5.The maximum size of a Visualforce email template is 1 MB.
6. You can’t send a mass email using a Visualforce email template. The {!Receiving_User.field_name}and {!Sending_User.field_name} merge fields work only for mass email and list email and are unavailable in Visualforce email templates.
7. In single email message if user use templateid then
1. You can’t send a mass email using a Visualforce email template.
2. You can use list<id> not set<id> in mass email .
3. You can use only TargetObjectIds () not TargetobjectId() because TargetObjectid() use in single.email message.
4. VF template support only recipient type USER, CONTACT, LEAD.
5.The maximum size of a Visualforce email template is 1 MB.
6. You can’t send a mass email using a Visualforce email template. The {!Receiving_User.field_name}and {!Sending_User.field_name} merge fields work only for mass email and list email and are unavailable in Visualforce email templates.
7. In single email message if user use templateid then
Targetobjectid should be required (User, contact, lead)
8. if TargetobjectId is user then Whatid is not required.
9 if user don't want to use TargetobjectId then add one more line as below:
mail.setTreatTargetObjectAsRecipient(false);
=============================================================================
Test class
1. We create test class for checking the functionality and deployment
2. For Deploy there is necessary that the test class should be pass and code coverage should be more than 75%
3. We can use the class variable in the test class by using instance of apex class which created in test class
============================================================================
Example:
@istest
static void testme()
{
contact c=new contact (lastname= 'Verma');
insert c;
ContactListVF cl=new ContactListVF();
cl.wcontact=c.id;
}
here wcontact is the variable of apex class
========================================================================
Formula field is not working parent
when any updation work on child and show on parent
=========================================================
Custom metadata
Custom metadata types enable you to create your own setup objects whose records are metadata rather than data. These are typically used to define application configurations that need to be migrated from one environment to another, or packaged and installed.
Rather than building apps from data records in custom objects or custom settings, you can create custom metadata types and add metadata records, with all the manageability that comes with metadata: package, deploy, and upgrade. Querying custom metadata records doesn't count against SOQL limits.
custom settings
Custom meta data have some extra field like as
Metadata relationship
Picklist
Text area long
===================
but it don't have one field ( currency ) which custom setting have like as
On web to lead captcha release in Spring 17
Custom meta data release in Summer 15
OpportunityProduct ( API opportunitylineItem ) is a junction object between opportunity and Product
api name of product is Producrt 2
api name of OpportunityProduct is opportunityLineItem
system admin have edit readonly permiossion which can edit read only field
================================================================
[FIND 'Wingo OR SFDC' IN ALL FIELDS RETURNING Account(Name),Contact(FirstName,LastName,Department)]
1. we can use Formula fields in soql query also but not vice versa
2. we can also fetch multi picklist values in soql query
Bucket Field :
we can apply bucket field only on Text, Numeric, Picklist and if you want apply on other then you should use formula fields
GEOLOCATION RELEASE
With Summer 16 release, auto-populating geocodes for addresses on Accounts, Contacts and Leads are made possible in Salesforce through geocode clean rules.
msing@retail2.demo
salesforce1
sanatan@grohe.demo
iconirt2019
Username: sanatan@rsc.demo loging.salesforce.com
Password: salesforce321
18602331234 shopper
====================================================================================
1.Multipick list value enter in dataloader with (;) seprator without space
2.dateformat should be in correct formate
3.for checkbox we put true and false on sheet
4.Bucket field is not work on joined report
5. you can create only 40,000 articles
6. stop all the test class which are in the queue
you can go to workbench --> utility --> Apex Execute then past the code
ApexTestQueueItem[] items = [SELECT Id FROM ApexTestQueueItem WHERE Status IN ('Holding','Queued','Preparing','Processing')];
for(ApexTestQueueItem item: items) {
item.Status = 'Aborted';
}
update items;
7. convert list to set
List<Account> accounts = [select Id, Name from Account];
Set<Id> ids = (new Map<Id,Account>(accounts)).keySet().clone();
8. For CTI (computer telephony integration)
steps
1. type call center in setup and then click on continue
2. import call center definition (XML file) which have which fields , what order of field , which api used
3. after import you will see all the detail
4. then in related list click on manage user
9. Hide follow or unfollow button on compact layout from case object
10 . parnet case can not close if any child case are open
/********************************************************************
Helper class : CaseCloseController
Trigger : it will execute on trigger Name: caseTrigger
Function : This Helper class check that parent case can not close untill all child case close
Author : Ankit Verma
Created On : 22/8/2019
Modified On : 23/8/2019
**********************************************************************/
public class CaseCloseController {
public static void caseError(list<case> cases)
{
set<id> parentCase = new set<id>(); // for getting id of parent
map<id, case> caseMap= new map<id,case>(cases);//
// iterating for getting the id of open case
for(case c: cases)
{
system.debug(' case valu is '+ c.IsClosed);
if(c.IsClosed)
{
parentCase.add(c.id);
}
}
system.debug('parent case id '+cases);
// getting all child case whose status are not closed
list<case>childCase=[select id, status, ParentId from case where ParentId =:parentCase AND isClosed= FALSE ];
system.debug('child case whose status are open'+childCase);
for(case c: childCase)
{
system.debug('child case whose status are open');
caseMap.get(c.ParentId).adderror('you have to close all child case first');
}
}
}
11.you can get record type id without querry :
String RecTypeId= [select Id from RecordType where (Name='Person Account') and (SobjectType='Account')].Id;
instead
String recordTypeId = Schema.getGlobalDescribe().get('Account').getDescribe().getRecordTypeInfosByName().get('Person Account').getRecordTypeId();
Id recorTypeId= Schema.SObjectType.Lead.getRecordTypeInfosByName().get('recordTypename').getRecordTypeId();
===============================================================================================================================
12. use trigger run once code
public class TriggerRunOnce
{
public static boolean Run = true;
public static boolean runOnce()
{
if(run)
{
run=false;
return true;
}
else
{
return run;
}
}
}
======================
in trigger write like as
if(TriggerRunOnce.runOnce())
13.. user object can not support field depandacy in picklist in lightning but you can do in classic
14. Up to 20 fields per object can be tracked. Certain field types such as auto-number, formula, roll-up summary and a few others cannot be tracked.
15. Business hours can be use in case , milestone, entitlement, case escalation
16. You can’t include the Business Hours field in list views or reports.
17. compare production or sand box class,file all things by url
https://sforgcompare.herokuapp.com/compare_orgs
18. WHERE CreatedDate > 2005-10-08T00:00:00Z
19. Show date instead of datetime use this
<aura:component>
<p><lightning:formattedDateTime value="1479944705000"/></p>
<p><lightning:formattedDateTime value="1479944705000" year="2-digit" month="short" day="2-digit" weekday="narrow"/></p>
<p><lightning:formattedDateTime value="1479944705000" year="2-digit" month="short" day="2-digit" weekday="long"/></p>
</aura:component>
20 . two field combination should be unique
create one unique field then create wf and update that unique field by concatenat abc__c + '' + bcd__c
21. Milestone Limitation
a. you can show actual time or business time on milestone status
b. milestone have field : status , elaspped time( day, hrs, min, sec,), violation, completed
https://help.salesforce.com/articleView?id=entitlements_best_practices.htm&type=5
22. challenge face to remove all picklist value.
23. entitlement can select only Two object 1. Case, 2. WorkOrder
24. The Lightning Process Builder and Flow do not support comma-separated values in rule criteria.
25. In processbuilder formulas Maximum length is 3,900 characters.
26. CASE FUNCTION NOT RETURN TRUE FALSE IF YOU WANT THEN YOU HAVE TO CREATE LIKE AS:
{{
IF(
CASE( Account.Type ,
"A", "true",
"B", "true",
"C", "true",
"false")
= "True", TRUE, FALSE)
}}
AND
(
IF(
CASE( [Case].Sub_Type__c ,
"string","true",
22. Custom picklist fields can be either controlling or dependent fields. Standard picklist fields can be controlling fields, but not dependent fields. Multi-select picklist fields can be dependent, but not controlling fields. You can set default values for controlling fields but not for dependent picklists.
23. While creating user report, manager filed can not come then we have to create formula field on user object then add column.
24. you can not only disable delete permission of task from profile you can stop edit permission of Activity so no one can
edit or delete the task.
25. formula field do not have email,picklist field
26 we can also grouping by formula field in reports.
27 Reports in "My Personal Custom Reports" and "Unfiled Public Reports" cannot be added to a change set and are not shown in this list
28 process builder run in system mode.
29 IN Process builder In update action don't have formulas based meeting criteria ()
30 After uploading change set we can not add any component.
31. If we are adding any WF rule then we have to add its action seprately.
32. Login Flow is profile specific
33. Duplicate rule:
a. you can active 5 duplicate rule per object
b. you can add 3 matching rule in one duplicate rule including one matching rule per object means per object you can add 3 matching rule in duplicate rule.
it is not working when any lead convertd by apex , restore record with undelete button, manually merged, records added using lightning sync
34. Approval process
Your org can now have up to 1,000 active and 2,000 total Approval Processes. Each object can have up to 300 active and 500 total Approval Processes.
35. you can assigen 1000 user per permission set.
36. task can assign to public group, user, and queue.
37. Getting value and label from picklist(Sales_Organization__c):
Schema.DescribeFieldResult fieldResult = Account.Sales_Organization__c.getDescribe();
List<Schema.PicklistEntry> values = fieldResult.getPicklistValues();
Map<String,String> MapValueLabel = new Map<String,String>();
String publicLabel;
for( Schema.PicklistEntry v : values) {
MapValueLabel.put(v.getValue(),v.getLabel());
}
38 database.upsert(recordToUpsert, externalIdField, allOrNone)
39. Quote only create only on negoatiation stage of opportunity
40 get one record from query because query return list
String quoteNumber=[select id,Quotation_Number__c from Quote__c where id=: quoteObjRec].Quotation_Number__c;
41. Create Clone of accounts
Create a detail page button --> Select content source URL --> type in forumal editor (/{!Account.Id}/e?clone=1)
42. if we update value of picklist by program then we have to assign api not label
43. enter date in program: Date.newInstance(2016, 12, 9);
44 call out exception: You have uncommitted work pending. Please commit or rollback before calling out.
45 Email proper format validation :
AND(
NOT(ISBLANK( Email )),
NOT(REGEX( Email ,'^[a-zA-Z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$')))
46 +8989 & -849839 is number but 990-99 is not the number
====================================================
47. stage can not be roll back validation;
ISCHANGED( Status__c ) &&
CASE(Status__c ,
"New", 1,
"Submitted to GFRC", 2,
"Completed by GFRC", 3,
0)
<
CASE(PRIORVALUE(Status__c ),
"New", 1,
"Submitted to GFRC", 2,
"Completed by GFRC", 3,
0)
======================================
48. hierachy custom setting:
Hierarchy__c CS = Hierarchy__c.getInstance(SysAdminID);
System.Assert(CS.OverrideMe__c == 'Goodbye');
System.assert(CS.DontOverrideMe__c == 'World');
49 list custom setting:
Map<String, Foundation_States__c> allstates = Foundation_States__c.getAll();
Map<String, Foundation_States__c> states = new Map<String, Foundation_States__c>();
for(Foundation_States__c state : allstates.values())
{
if (state.country_code__c == this.country)
{
states.put(state.name, state);
}
}
=====================================================================
50. If we get any text value which is '001' from dataloader then in csv it give only 1 as a numeric value
so after export we have to change that format to text and update the value as '001' then after we can import correct value.
51. we can put any thing in object type ex:
Map<String,Object> msg = new Map<String,Object>();
msg.put('text', 'The following opportunity has changed:\n' + opportunity.Name + '\nNew Stage: *' + opportunity.StageName + '*');
52 . Agile Accelator is a free app which work on agile methology.
53. VS code command
in command prompt type: "sfdx" to check vs code installed successfully
Type: "sfdx Update" to check CLI installed successfully
54. Bulk object field creator app, Salesforce Inspector, Agile salsforce app, in slaesforce
=================================================================================================
55. Auto approval by trigger
trigger Risk_Build_Approval on Opportunity (after update)
{
for(Opportunity o: trigger.new){
Opportunity oldOpp = trigger.oldMap.get(o.Id);
if(o.risk_build__c == 'Yes' && oldOpp.risk_build__c <> 'Yes')
{
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(o.id);
Approval.ProcessResult result = Approval.process(req1);
System.assert(result.isSuccess());
}
}
}
===============================================================
56. Getting date only from date time
DateTime edT = bpp.End_Date__c;
String endTime;
endTime= edT.format('dd MMMM, yyyy');
=======================================================
57. Date for Vf page
test.startTest();
Demand__c de = [select id from Demand__c];
system.debug('DEmand id'+de);
PageReference pageRef = Page.DemandPDF;
pageRef.getParameters().put('Id',de.Id);
// ApexPages.StandardController sc = new ApexPages.StandardController(de);
ApexPages.currentPage().getParameters().put('Id', de.Id);
DemandPDFCntrl dePDF = new DemandPDFCntrl();
Test.setCurrentPage(pageRef);
dePDF.getCompanyLogo();
Test.stopTest();
========================================
62. Getting record Type name from an object.
[select Id,DeveloperName from RecordType where sObjectType='Stock_Visibility_Survey__c']
=========================================
63. use Switch in for loop
for(integer i=0;i<5;i++){
switch on i {
when 0 {
Objective_Master__c objMaster = new Objective_Master__c();
}
when 1 {
Objective_Master__c objMaster = new Objective_Master__c();
}
when 2 {
Objective_Master__c objMaster = new Objective_Master__c();
}
when 3 {
Objective_Master__c objMaster = new Objective_Master__c();
ob
}
when else {
Objective_Master__c objMaster = new Objective_Master__c();
}
}
}
=====================================================================
64.
Base64encoading return string and base64decode return blob
Blob blobValue = Blob.valueOf('test document to attach to account');
string encodeString= EncodingUtil.base64encode(blobValue);
blob decodeString =EncodingUtil.base64Decode(encodeString);
===================================================================
65. Save All values from vf page of an object. and show details page.
public class CollectionCallController {
public Call_Audit__c CA{get;set;}
public CollectionCallController(ApexPages.standardController a)
{
this.CA=(Call_Audit__c)a.getRecord();
}
public pageReference save(){
CA.Collection_calling__c= true;
upsert CA;
PageReference pg = new PageReference('/apex/CollectionCallAuditForm?id='+CA.id);
pg.setRedirect(true);
return pg;
}
}
=====================================================================
67. Only marketing user can create Campaign record.
===================================================================
68. User Locale value can set the time formate of user
EX:
Locale(India)= dd/mm/yyyy
Locale(Us)= mm/dd/yyyy
==================================================================
69. If Error Came as:
NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.: []".
then Go to Setup --> Quick Find Box ---> Deliverability --> (Access Level: All emails from System email
============================================================================
70. How to know the limit is breached of records from soql
Integer remainingRows = Limits.getLimitQueryRows() - Limits.getQueryRows();
[SELECT id FROM RecordType Limit :remainingRows]
=============================================================================================
71. Creating map and putting value in map without for loop
Map<Id, Account> conflictAccountMap = new Map<Id, Account>([Select Id, (Select Id, Unit__r.Name, OwnerId From Facilities__r), OwnerId, Name, Converted_Mobile_Number__c, Doctor_s_National_Registration_Number__c, Doctor_s_State_Registration_Number__c From Account Limit :remainingRows]);
=============================================================================
72. API limit in salesforce.
For Salesforce Professional and Enterprise, each organization receives a total of 1,000 API calls per user in a 24-hour period, up to a maximum of 1,000,000 API calls (for organizations with 15,000+ Salesforce licenses). Salesforce Unlimited has a 5,000 API calls per user limit, up to a maximum of unlimited API calls.
=====================================================================
73. Custom field limit is 40 Character.and special character not allowed on API.
74. When any filed deployed to the production then field visibility on the profile will again enable.
75. With the help of Formula field We can handle two fields
Ex-: Formula Field
Formula: if(ISNULL(amount__c), PendingAmount __c, TotalAmount__c)
76. Developer org can send 10 external emails per day only to external
reference link:- https://help.salesforce.com/articleView?id=limitations_email_mass.htm&type=5
77. Mass email does not send using VF Email Template.
78. If You want that if any process builder fails then you got error message then
go to setup --> process automation setting --> Change apex exception mail recipient and go to setup
--> Apex exception mail --> Enter your email..
79. If you want to get approver mail also Like when any approver mail sends to another user then you go to setup --> compliance BCC address --> enter your email --> save.
80. We can not call any scheduler from the apex class. but we can call any normal class from the scheduler Execute method.
81. Getting a query for batch
public Database.queryLocator start(Database. batchableContext bc)
{
DescribeSObjectResult describeResult = Invoice_Staging__c.getSObjectType().getDescribe();
List<String> fields = new List<String>(describeResult.fields.getMap().keySet());
String query = 'SELECT ' + String.join(fields,',') +' FROM Invoice_Staging__c Where EpisodeType__c = \'IPD\' ';
system.debug(query);
}
81. We can not perform manual sharing on lightning experience
82 we can perform 7 actions on lightning Quick action
1. call a log
2. VF page
3. lightning component
4. send mail
5. update record
6. create a record
7. Flow call
82 Send list of email using permission set
create a permission set --> System Permission --> enable Allow sending list email --> assigned to user
83. Toggle functionality in LEX component
Reference link: https://sfdcmonkey.com/2019/03/05/create-expand-collapse-sections-salesforce-lightning/
84. Open PDF in lightning also Classic by button
Create button--> Select content source URL --> type URL
/apex/VFPDFPage?id={! object__c.Id }
85. we can pass only one parameter in the Invocable method
86. Salesforce calculates the limit by multiplying the number of user licenses by 1,000, up to a daily maximum of 1,000,000.
87. In invocablemethod
1. we can pass only one parameter which should be LIST type
2. method should be STATIC.
3. we can create only one invocable method in the class
88. getting list of Id in a single query
List<Id> momId = new List<Id>(new Map<Id, Minutes_Of_Meeting__c>([select Id from Minutes_Of_Meeting__c]).keySet());
89.Override a button with the Lightning button :
Just implement "lightning:actionOverride" interface in the lightning component then this component can use in the standard button.
90.We can handle the VF pages based on Profile.
Setup =>Visualforce Page=> Security=> Select Profile.
91. If account records are private and opportunity is share then account records can override the sharing setting.
if records are share with any other user then we can see the reason with the sharing button in the classic view.
92. If you disable the GRANT ACCESS USING HIERARCHY then still records share to another user then maybe that record's activity assigned to User. (*).
93. Always have access
These reasons always gain access:
Group Member Queue Member Role Member Member of Subordinate Role Territory Member Member of Subordinate Territory
These reasons only gain access when using hierarchies:
Manager of Group Member Manager of Queue Member Manager of Role Manager of Territory User Role Manager of Territory
94. If you want to install the package in sandbox then change the first URL
like as :
https://login.salesforce.com/packaging/installPackage.apexp?p0=XXXXXX&isdtp=p1
https://Test.salesforce.com/packaging/installPackage.apexp?p0=XXXXXXXX&isdtp=p1
when any updation work on child and show on parent
=========================================================
Custom metadata
Custom metadata types enable you to create your own setup objects whose records are metadata rather than data. These are typically used to define application configurations that need to be migrated from one environment to another, or packaged and installed.
Rather than building apps from data records in custom objects or custom settings, you can create custom metadata types and add metadata records, with all the manageability that comes with metadata: package, deploy, and upgrade. Querying custom metadata records doesn't count against SOQL limits.
custom settings
Use custom settings to create and manage custom data at the organization, profile, and user levels. Custom settings data is stored in the application cache. This means you can access it efficiently, without the cost of repeated queries. Custom settings data can be used by formula fields, Visualforce, Apex, and the Web Services API.
Custom meta data have some extra field like as
Metadata relationship
Picklist
Text area long
===================
but it don't have one field ( currency ) which custom setting have like as
On web to lead captcha release in Spring 17
Custom meta data release in Summer 15
OpportunityProduct ( API opportunitylineItem ) is a junction object between opportunity and Product
api name of product is Producrt 2
api name of OpportunityProduct is opportunityLineItem
system admin have edit readonly permiossion which can edit read only field
================================================================
- System.Assert accepts two parameters, one (mandatory) which is the condition to test for and the other a message (optional) to display should that condition be false.
- System.AssertEquals and System.AssertNotEquals both accepts three parameters; the first two (mandatory) are the variables that will be tested for in/equality and the third (optional) is the message to display if the assert results in false.
[ system.assertEquals(expected, actual) ]
Difference between Action support and command button
Action support can be use for all javaScript event like click ,focus,on change ,keyup etc
but command button is basically use for submit the data to server side
Q: How to hide / show developer console in org
A: In profile go to edit and enable the checkbox of ( Author apex and View all ) then it will show
for hiding you cab disable these check box
Q: How we can understand the concept of with sharing or without sharing ?
A: create a class and create a apex page and in open that apex page in different profile or user then you will easily understand this concept.
* you have to add the vf page in that profile
===============================================================
Use SOSL
Syntax
FIND 'SearchQuery' [ IN SearchGroup] [RETURNING ObjectsAndFields]
Difference between Action support and command button
Action support can be use for all javaScript event like click ,focus,on change ,keyup etc
but command button is basically use for submit the data to server side
Q: How to hide / show developer console in org
A: In profile go to edit and enable the checkbox of ( Author apex and View all ) then it will show
for hiding you cab disable these check box
Q: How we can understand the concept of with sharing or without sharing ?
A: create a class and create a apex page and in open that apex page in different profile or user then you will easily understand this concept.
* you have to add the vf page in that profile
===============================================================
Use SOSL
Syntax
FIND 'SearchQuery' [ IN SearchGroup] [RETURNING ObjectsAndFields]
SearchQuery is the text to search for (a single word or a phrase). Search terms can be grouped with logical operators (AND, OR) and parentheses. Also, search terms can include wildcard characters (*, ?). The * wildcard matches zero or more characters at the middle or end of the search term. The ? wildcard matches only one character at the middle or end of the search term.
SearchGroup is optional. It is the scope of the fields to search. If not specified, the default search scope is all fields. SearchGroup can take one of the following values.
- For APEX, a literal string must be enclosed in single quotes.
- For force.com API (SOAP API), it should be demarcated with braces.
- ALL FIELDS
- NAME FIELDS
- EMAIL FIELDS
- PHONE FIELDS
- SIDEBAR FIELDS
[FIND 'Wingo OR SFDC' IN ALL FIELDS RETURNING Account(Name),Contact(FirstName,LastName,Department)]
1. we can use Formula fields in soql query also but not vice versa
2. we can also fetch multi picklist values in soql query
Bucket Field :
we can apply bucket field only on Text, Numeric, Picklist and if you want apply on other then you should use formula fields
GEOLOCATION RELEASE
With Summer 16 release, auto-populating geocodes for addresses on Accounts, Contacts and Leads are made possible in Salesforce through geocode clean rules.
Manage Sets of Apex Test Classes with Test Suites
A test suite is a collection of Apex test classes that you run together. For example, create a suite of tests that you run every time you prepare for a deployment or Salesforce releases a new version. Set up a test suite in the Developer Console to define a set of test classes that you execute together regularly.
- In the Developer Console, select .
- Enter a name for your test suite, and then click OK.
- Use the arrows to move classes between the Available Test Classes column and the Selected Test Classes column, and then click Save.
To change which classes are in a test suite, select Save.
. (You can also double-click a test suite’s name to edit the suite.) Use the arrows to move classes between the Available Test Classes column and the Selected Test Classes column, and then click
To run suites of test classes, select
.
You can add up to a maximum of 200 test classes per TestSuite.
From the beginning of Spring 16 release orgs.
How to query list of Test Suites and Test Suite Members?
ApexTestSuite: To know the list of available Test Suites.
Select Id, Name FROM ApexTestSuite
TestSuiteMembership: Represents a class in an ApexTestSuite.
SELECT Id FROM TestSuiteMembership WHERE ApexTestSuiteId = ’05FD000hhgjhjhg′.
=====================================================================
salesforce1
sanatan@grohe.demo
iconirt2019
Username: sanatan@rsc.demo loging.salesforce.com
Password: salesforce321
18602331234 shopper
====================================================================================
1.Multipick list value enter in dataloader with (;) seprator without space
2.dateformat should be in correct formate
3.for checkbox we put true and false on sheet
4.Bucket field is not work on joined report
5. you can create only 40,000 articles
6. stop all the test class which are in the queue
you can go to workbench --> utility --> Apex Execute then past the code
ApexTestQueueItem[] items = [SELECT Id FROM ApexTestQueueItem WHERE Status IN ('Holding','Queued','Preparing','Processing')];
for(ApexTestQueueItem item: items) {
item.Status = 'Aborted';
}
update items;
7. convert list to set
List<Account> accounts = [select Id, Name from Account];
Set<Id> ids = (new Map<Id,Account>(accounts)).keySet().clone();
8. For CTI (computer telephony integration)
steps
1. type call center in setup and then click on continue
2. import call center definition (XML file) which have which fields , what order of field , which api used
3. after import you will see all the detail
4. then in related list click on manage user
9. Hide follow or unfollow button on compact layout from case object
10 . parnet case can not close if any child case are open
/********************************************************************
Helper class : CaseCloseController
Trigger : it will execute on trigger Name: caseTrigger
Function : This Helper class check that parent case can not close untill all child case close
Author : Ankit Verma
Created On : 22/8/2019
Modified On : 23/8/2019
**********************************************************************/
public class CaseCloseController {
public static void caseError(list<case> cases)
{
set<id> parentCase = new set<id>(); // for getting id of parent
map<id, case> caseMap= new map<id,case>(cases);//
// iterating for getting the id of open case
for(case c: cases)
{
system.debug(' case valu is '+ c.IsClosed);
if(c.IsClosed)
{
parentCase.add(c.id);
}
}
system.debug('parent case id '+cases);
// getting all child case whose status are not closed
list<case>childCase=[select id, status, ParentId from case where ParentId =:parentCase AND isClosed= FALSE ];
system.debug('child case whose status are open'+childCase);
for(case c: childCase)
{
system.debug('child case whose status are open');
caseMap.get(c.ParentId).adderror('you have to close all child case first');
}
}
}
11.you can get record type id without querry :
String RecTypeId= [select Id from RecordType where (Name='Person Account') and (SobjectType='Account')].Id;
instead
String recordTypeId = Schema.getGlobalDescribe().get('Account').getDescribe().getRecordTypeInfosByName().get('Person Account').getRecordTypeId();
Id recorTypeId= Schema.SObjectType.Lead.getRecordTypeInfosByName().get('recordTypename').getRecordTypeId();
===============================================================================================================================
12. use trigger run once code
public class TriggerRunOnce
{
public static boolean Run = true;
public static boolean runOnce()
{
if(run)
{
run=false;
return true;
}
else
{
return run;
}
}
}
======================
in trigger write like as
if(TriggerRunOnce.runOnce())
13.. user object can not support field depandacy in picklist in lightning but you can do in classic
14. Up to 20 fields per object can be tracked. Certain field types such as auto-number, formula, roll-up summary and a few others cannot be tracked.
15. Business hours can be use in case , milestone, entitlement, case escalation
16. You can’t include the Business Hours field in list views or reports.
17. compare production or sand box class,file all things by url
https://sforgcompare.herokuapp.com/compare_orgs
18. WHERE CreatedDate > 2005-10-08T00:00:00Z
19. Show date instead of datetime use this
<aura:component>
<p><lightning:formattedDateTime value="1479944705000"/></p>
<p><lightning:formattedDateTime value="1479944705000" year="2-digit" month="short" day="2-digit" weekday="narrow"/></p>
<p><lightning:formattedDateTime value="1479944705000" year="2-digit" month="short" day="2-digit" weekday="long"/></p>
</aura:component>
20 . two field combination should be unique
create one unique field then create wf and update that unique field by concatenat abc__c + '' + bcd__c
21. Milestone Limitation
a. you can show actual time or business time on milestone status
b. milestone have field : status , elaspped time( day, hrs, min, sec,), violation, completed
https://help.salesforce.com/articleView?id=entitlements_best_practices.htm&type=5
22. challenge face to remove all picklist value.
23. entitlement can select only Two object 1. Case, 2. WorkOrder
24. The Lightning Process Builder and Flow do not support comma-separated values in rule criteria.
25. In processbuilder formulas Maximum length is 3,900 characters.
26. CASE FUNCTION NOT RETURN TRUE FALSE IF YOU WANT THEN YOU HAVE TO CREATE LIKE AS:
{{
IF(
CASE( Account.Type ,
"A", "true",
"B", "true",
"C", "true",
"false")
= "True", TRUE, FALSE)
}}
AND
(
IF(
CASE( [Case].Sub_Type__c ,
"string","true",
22. Custom picklist fields can be either controlling or dependent fields. Standard picklist fields can be controlling fields, but not dependent fields. Multi-select picklist fields can be dependent, but not controlling fields. You can set default values for controlling fields but not for dependent picklists.
23. While creating user report, manager filed can not come then we have to create formula field on user object then add column.
24. you can not only disable delete permission of task from profile you can stop edit permission of Activity so no one can
edit or delete the task.
25. formula field do not have email,picklist field
26 we can also grouping by formula field in reports.
27 Reports in "My Personal Custom Reports" and "Unfiled Public Reports" cannot be added to a change set and are not shown in this list
28 process builder run in system mode.
29 IN Process builder In update action don't have formulas based meeting criteria ()
30 After uploading change set we can not add any component.
31. If we are adding any WF rule then we have to add its action seprately.
32. Login Flow is profile specific
33. Duplicate rule:
a. you can active 5 duplicate rule per object
b. you can add 3 matching rule in one duplicate rule including one matching rule per object means per object you can add 3 matching rule in duplicate rule.
it is not working when any lead convertd by apex , restore record with undelete button, manually merged, records added using lightning sync
34. Approval process
Your org can now have up to 1,000 active and 2,000 total Approval Processes. Each object can have up to 300 active and 500 total Approval Processes.
35. you can assigen 1000 user per permission set.
36. task can assign to public group, user, and queue.
37. Getting value and label from picklist(Sales_Organization__c):
Schema.DescribeFieldResult fieldResult = Account.Sales_Organization__c.getDescribe();
List<Schema.PicklistEntry> values = fieldResult.getPicklistValues();
Map<String,String> MapValueLabel = new Map<String,String>();
String publicLabel;
for( Schema.PicklistEntry v : values) {
MapValueLabel.put(v.getValue(),v.getLabel());
}
38 database.upsert(recordToUpsert, externalIdField, allOrNone)
39. Quote only create only on negoatiation stage of opportunity
40 get one record from query because query return list
String quoteNumber=[select id,Quotation_Number__c from Quote__c where id=: quoteObjRec].Quotation_Number__c;
41. Create Clone of accounts
Create a detail page button --> Select content source URL --> type in forumal editor (/{!Account.Id}/e?clone=1)
42. if we update value of picklist by program then we have to assign api not label
43. enter date in program: Date.newInstance(2016, 12, 9);
44 call out exception: You have uncommitted work pending. Please commit or rollback before calling out.
45 Email proper format validation :
AND(
NOT(ISBLANK( Email )),
NOT(REGEX( Email ,'^[a-zA-Z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$')))
46 +8989 & -849839 is number but 990-99 is not the number
====================================================
47. stage can not be roll back validation;
ISCHANGED( Status__c ) &&
CASE(Status__c ,
"New", 1,
"Submitted to GFRC", 2,
"Completed by GFRC", 3,
0)
<
CASE(PRIORVALUE(Status__c ),
"New", 1,
"Submitted to GFRC", 2,
"Completed by GFRC", 3,
0)
======================================
48. hierachy custom setting:
Hierarchy__c CS = Hierarchy__c.getInstance(SysAdminID);
System.Assert(CS.OverrideMe__c == 'Goodbye');
System.assert(CS.DontOverrideMe__c == 'World');
49 list custom setting:
Map<String, Foundation_States__c> allstates = Foundation_States__c.getAll();
Map<String, Foundation_States__c> states = new Map<String, Foundation_States__c>();
for(Foundation_States__c state : allstates.values())
{
if (state.country_code__c == this.country)
{
states.put(state.name, state);
}
}
=====================================================================
50. If we get any text value which is '001' from dataloader then in csv it give only 1 as a numeric value
so after export we have to change that format to text and update the value as '001' then after we can import correct value.
51. we can put any thing in object type ex:
Map<String,Object> msg = new Map<String,Object>();
msg.put('text', 'The following opportunity has changed:\n' + opportunity.Name + '\nNew Stage: *' + opportunity.StageName + '*');
52 . Agile Accelator is a free app which work on agile methology.
53. VS code command
in command prompt type: "sfdx" to check vs code installed successfully
Type: "sfdx Update" to check CLI installed successfully
54. Bulk object field creator app, Salesforce Inspector, Agile salsforce app, in slaesforce
=================================================================================================
55. Auto approval by trigger
trigger Risk_Build_Approval on Opportunity (after update)
{
for(Opportunity o: trigger.new){
Opportunity oldOpp = trigger.oldMap.get(o.Id);
if(o.risk_build__c == 'Yes' && oldOpp.risk_build__c <> 'Yes')
{
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(o.id);
Approval.ProcessResult result = Approval.process(req1);
System.assert(result.isSuccess());
}
}
}
===============================================================
56. Getting date only from date time
DateTime edT = bpp.End_Date__c;
String endTime;
endTime= edT.format('dd MMMM, yyyy');
=======================================================
57. Date for Vf page
<apex:outputText value="{0,date,yyyy.MM.dd}"> <apex:param value="{!MyVar.Holiday_Date__c}"/> <apex:outputText>
=============================================================================
58.Date for lightning component.
<lightning:formattedDateTime value="{!x.CreatedDate}" /></td>
=======================================================================
59. you can also create formula field then get the date only
============================================================
60 get yesterdat
Date yesterdaydate=Date.today().adddays(-1);
============================================
61.
Test class for VF page PDFtest.startTest();
Demand__c de = [select id from Demand__c];
system.debug('DEmand id'+de);
PageReference pageRef = Page.DemandPDF;
pageRef.getParameters().put('Id',de.Id);
// ApexPages.StandardController sc = new ApexPages.StandardController(de);
ApexPages.currentPage().getParameters().put('Id', de.Id);
DemandPDFCntrl dePDF = new DemandPDFCntrl();
Test.setCurrentPage(pageRef);
dePDF.getCompanyLogo();
Test.stopTest();
========================================
62. Getting record Type name from an object.
[select Id,DeveloperName from RecordType where sObjectType='Stock_Visibility_Survey__c']
=========================================
63. use Switch in for loop
for(integer i=0;i<5;i++){
switch on i {
when 0 {
Objective_Master__c objMaster = new Objective_Master__c();
}
when 1 {
Objective_Master__c objMaster = new Objective_Master__c();
}
when 2 {
Objective_Master__c objMaster = new Objective_Master__c();
}
when 3 {
Objective_Master__c objMaster = new Objective_Master__c();
ob
}
when else {
Objective_Master__c objMaster = new Objective_Master__c();
}
}
}
=====================================================================
64.
Base64encoading return string and base64decode return blob
Blob blobValue = Blob.valueOf('test document to attach to account');
string encodeString= EncodingUtil.base64encode(blobValue);
blob decodeString =EncodingUtil.base64Decode(encodeString);
===================================================================
65. Save All values from vf page of an object. and show details page.
public class CollectionCallController {
public Call_Audit__c CA{get;set;}
public CollectionCallController(ApexPages.standardController a)
{
this.CA=(Call_Audit__c)a.getRecord();
}
public pageReference save(){
CA.Collection_calling__c= true;
upsert CA;
PageReference pg = new PageReference('/apex/CollectionCallAuditForm?id='+CA.id);
pg.setRedirect(true);
return pg;
}
}
=====================================================================
67. Only marketing user can create Campaign record.
===================================================================
68. User Locale value can set the time formate of user
EX:
Locale(India)= dd/mm/yyyy
Locale(Us)= mm/dd/yyyy
==================================================================
69. If Error Came as:
NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile.: []".
then Go to Setup --> Quick Find Box ---> Deliverability --> (Access Level: All emails from System email
70. How to know the limit is breached of records from soql
Integer remainingRows = Limits.getLimitQueryRows() - Limits.getQueryRows();
[SELECT id FROM RecordType Limit :remainingRows]
=============================================================================================
71. Creating map and putting value in map without for loop
Map<Id, Account> conflictAccountMap = new Map<Id, Account>([Select Id, (Select Id, Unit__r.Name, OwnerId From Facilities__r), OwnerId, Name, Converted_Mobile_Number__c, Doctor_s_National_Registration_Number__c, Doctor_s_State_Registration_Number__c From Account Limit :remainingRows]);
=============================================================================
72. API limit in salesforce.
For Salesforce Professional and Enterprise, each organization receives a total of 1,000 API calls per user in a 24-hour period, up to a maximum of 1,000,000 API calls (for organizations with 15,000+ Salesforce licenses). Salesforce Unlimited has a 5,000 API calls per user limit, up to a maximum of unlimited API calls.
=====================================================================
73. Custom field limit is 40 Character.and special character not allowed on API.
74. When any filed deployed to the production then field visibility on the profile will again enable.
75. With the help of Formula field We can handle two fields
Ex-: Formula Field
Formula: if(ISNULL(amount__c), PendingAmount __c, TotalAmount__c)
76. Developer org can send 10 external emails per day only to external
reference link:- https://help.salesforce.com/articleView?id=limitations_email_mass.htm&type=5
77. Mass email does not send using VF Email Template.
78. If You want that if any process builder fails then you got error message then
go to setup --> process automation setting --> Change apex exception mail recipient and go to setup
--> Apex exception mail --> Enter your email..
79. If you want to get approver mail also Like when any approver mail sends to another user then you go to setup --> compliance BCC address --> enter your email --> save.
80. We can not call any scheduler from the apex class. but we can call any normal class from the scheduler Execute method.
81. Getting a query for batch
public Database.queryLocator start(Database. batchableContext bc)
{
DescribeSObjectResult describeResult = Invoice_Staging__c.getSObjectType().getDescribe();
List<String> fields = new List<String>(describeResult.fields.getMap().keySet());
String query = 'SELECT ' + String.join(fields,',') +' FROM Invoice_Staging__c Where EpisodeType__c = \'IPD\' ';
system.debug(query);
}
81. We can not perform manual sharing on lightning experience
82 we can perform 7 actions on lightning Quick action
1. call a log
2. VF page
3. lightning component
4. send mail
5. update record
6. create a record
7. Flow call
82 Send list of email using permission set
create a permission set --> System Permission --> enable Allow sending list email --> assigned to user
83. Toggle functionality in LEX component
Reference link: https://sfdcmonkey.com/2019/03/05/create-expand-collapse-sections-salesforce-lightning/
84. Open PDF in lightning also Classic by button
Create button--> Select content source URL --> type URL
/apex/VFPDFPage?id={! object__c.Id }
85. we can pass only one parameter in the Invocable method
86. Salesforce calculates the limit by multiplying the number of user licenses by 1,000, up to a daily maximum of 1,000,000.
87. In invocablemethod
1. we can pass only one parameter which should be LIST type
2. method should be STATIC.
3. we can create only one invocable method in the class
88. getting list of Id in a single query
List<Id> momId = new List<Id>(new Map<Id, Minutes_Of_Meeting__c>([select Id from Minutes_Of_Meeting__c]).keySet());
89.Override a button with the Lightning button :
Just implement "lightning:actionOverride" interface in the lightning component then this component can use in the standard button.
90.We can handle the VF pages based on Profile.
Setup =>Visualforce Page=> Security=> Select Profile.
91. If account records are private and opportunity is share then account records can override the sharing setting.
if records are share with any other user then we can see the reason with the sharing button in the classic view.
92. If you disable the GRANT ACCESS USING HIERARCHY then still records share to another user then maybe that record's activity assigned to User. (*).
93. Always have access
like as :
https://login.salesforce.com/packaging/installPackage.apexp?p0=XXXXXX&isdtp=p1
https://Test.salesforce.com/packaging/installPackage.apexp?p0=XXXXXXXX&isdtp=p1
95. Getting Label not the picklist Api from soql querry.
use toLabel(Picklist Fieldapi)
select id,name, toLabel(Product_Sub_Type__c), toLabel(Product_Type__c) from Material__c where id='a0e1b000002iPRvAAM'
96. Getting map from query
Map<Id, Minutes_Of_Meeting__c> Mymap =Map<Id, Minutes_Of_Meeting__c> ([select Id, name from Minutes_Of_Meeting__c]);
97. Getting list of Id from Query
List<Id> momId = new List<Id>(new Map<Id, Minutes_Of_Meeting__c>([select Id from Minutes_Of_Meeting__c]).keySet());
MYmap.putAll(myList);
99. Call flow from URL Button
Create a Detail page button and Enter below link in the URL:
/flow/Mom_internal_external?varInputMomId={!Minutes_Of_Meeting__c.Id}&retURL={!Minutes_Of_Meeting__c.Id}
100. Show and hide lightning component by using below:
<aura:renderIf isTrue="{!v.rendered}">
101. Custom pick list with different label and value:
<apex:selectList value="{!cntobj.doc_type__c}" size="1">
<apex:selectoption itemLabel="Factory Sales Dahej - Z001" itemValue="Z001" />
<apex:selectoption itemLabel="Factory Sales Ranjit - Z002" itemValue="Z002" />
<apex:selectoption itemLabel="Depot Sales Order - Z004 " itemValue="Z004" />
<apex:selectoption itemLabel="Deemed Export Dahej - Z012 " itemValue="Z012" />
<apex:selectoption itemLabel="Thane Depot Sales OR - Z013 " itemValue="Z013" />
<apex:selectoption itemLabel="SR Depot to Factory - Z014 " itemValue="Z014" />
<apex:selectoption itemLabel="ExportDepot Sales OR - Z023 " itemValue="Z023" />
</apex:selectList>
102. Get Account id Hyperlink on Rich text Field
use code i apex class: SuccessaccIds += '<a href="/' +acs.accountId +'">' +acs.accountId +'</a>,';
Note: SuccessaccIds is a string which populated on the custom field.
103. Add break line in Long text area filed using apex.
OT= ord.Standard_terms__c.replaceAll('\n','<br />');
104. Count decimal value up to 2 places.
Decimal d = 103.3586;
Double ans = d.setScale(2);
system.debug('value is '+ans);
105. How to set Assignment rule by Apex
Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule= true;
newlead.setOptions(dmo);
Note: Where newlead is a object reference variable.
106. If any class scheduled then the user can not modify the apex class.
107. From vf page get the Lightning page URL
public PageReference back(){
return new pagereference(url.getsalesforcebaseurl().toexternalform()+'/'+accObjRec);
}
108. Immediate Keyword in command Button in VF page
A Boolean value that specifies whether the action associated with this component should happen immediately, without processing any validation rules associated with the fields on the page. If set to true, the action happens immediately and validation rules are skipped. If not specified, this value defaults to false.
109. We can not directly create the field on task and event object for this we have to create a field on the Activity object.
110. Why Future method can not pass the non premitve data. (Sobject, Apec class, etc)
ANS;
- Why we cannot pass the object (custom, standard) as a parameter? Remember we are working with asynchronous apex they will execute only when the resources are available so if we use the object as a parameter then the system will not hold the current data.
111. Inline Editing on line view
Ref URL: https://help.salesforce.com/articleView?id=000323035&type=1&mode=1
URL: https://salesforce.stackexchange.com/questions/312341/disable-inline-editing-for-fields-in-the-list-view-in-lightning
No comments:
Post a Comment