Salesforce adding hyphen (-) to the Opportunity Name

This is Standard Salesforce functionality. By default, Salesforce allows you to add the name which starts with Account Name -. So that user can edit that name and use some other name. Generally people use Account Name-Opportunity Name.


Check this for more information.

https://help.salesforce.com/articleView?id=000193659&type=1

How to subscribe to Salesforce Change Data Capture from MuleSoft?

To know about Change Data Capture, check the below link

https://www.infallibletechie.com/2019/05/change-data-capture-in-salesforce.html

Salesforce Change Data Capture:



MuleSoft Flow:



Subscribe Channel Configuration:



Transform Message Configuration:



Logger Configuration:



Output:



Change Data Capture in Salesforce

A CDC event, or change event, is a notification that Salesforce sends when a change to a Salesforce record occurs as part of a create, update, delete, or undelete operation. The notification includes all new and changed fields, and header fields that contain information about the change. For example, header fields indicate the type of change that triggered the event and the origin of the change. Change events support all custom objects and a subset of standard objects.

When to use Change Data Capture
Use change events to:

1. Receive notifications of Salesforce record changes, including create, update, delete, and undelete operations.
2. Capture field changes for all records.
3. Get broad access to all data regardless of sharing rules.
4. Get information about the change in the event header, such as the origin of the change, which allows ignoring changes that your client generates.
5. Perform data updates using transaction boundaries.
6. Use a versioned event schema.
7. Subscribe to mass changes in a scalable way.
8. Get access to retained events for up to three days.

Subscription Channels
Use the subscription channel that corresponds to the change notifications you want to receive. The channel name is case-sensitive.

All Change Events
/data/ChangeEvents

A Standard Object
/data/<Standard_Object_Name>ChangeEvent

For example, the channel to subscribe to change events for Account records is:
/data/AccountChangeEvent

A Custom Object
/data/<Custom_Object_Name>__ChangeEvent

For example, the channel to subscribe to change events for Employee__c custom object records is:
/data/Employee__ChangeEvent

How to set it up

1. Go to Change Data Capture.


2. Select and add objects from Available to Selected Entities.


System Mode and User Mode in Salesforce

Trigger runs in System mode. If triggers calls an apex class with sharing keyword, then record level access will be considered.

Validation Rule runs in System mode.

Auto Response Rule runs in System mode.

Assignment Rule runs in System mode.

Workflow Rule runs in System mode.

Escalation Rule runs in System mode.

Formula, Rollup Summary runs in System mode.

Process Builder runs in System mode.

Custom Button runs in System mode.

Visual Workflow or flow runs in User mode.
If flow is called from Process Builder, then runs in System mode.
If flow is called from Workflow, then runs in System mode.
If flow is called from Apex, then runs in (depends on with or without sharing of apex class).
If flow is called from Custom Button, then runs in System mode.
If flow is embed in Visualforce, then runs in VFP context.
If flow is called from REST API, then runs in System mode.

Approval Process runs in System mode.

Publisher Action runs in System mode.

InvocableMethod
If this is called from flow, then runs in User mode.
If this is called from Process Builder (does it depends on with or without sharing is specified on that Class), then runs in System mode.
if this is called from REST API, then runs in (depends on with or without sharing of the class).

Test method with System.runAs() runs in User mode.
Test method without System.runAs() runs in System mode.

Visualforce Page (StandardController) runs in User mode.
Visualforce Page (StandardController with extension) runs in System mode.
Visualforce Page (Custom Controller) - Based on the sharing keyword usage in the apex class.
Visualforce Component runs in depends on Visualforce page where it is used.

Macros runs in System mode.

Annonymous Apex runs in User mode.

Chatter in Apex runs in User mode.

Email Service runs in User mode.

All types of Jobs runs in System mode.

Apex Webservices (SOAP API and REST API) runs in System mode. 

How to ensure Field Level Security in SOQL in Salesforce?

Use the WITH SECURITY_ENFORCED clause to enable field and object level security permissions checking for SOQL SELECT queries in Apex code, including subqueries and cross-object relationships.

If any fields or objects referenced in the SOQL SELECT query using WITH SECURITY_ENFORCED are inaccessible to the user, an exception is thrown, and no data is returned.

Example
If field access for either LastName or Description is hidden, this query throws an exception indicating insufficient permissions.
view sourceprint?

List<Account> act1 = [SELECT Id, (SELECT LastName FROM Contacts),
   (SELECT Description FROM Opportunities)
   FROM Account WITH SECURITY_ENFORCED]

The WITH SECURITY_ENFORCED clause is only available in Apex. Using WITH SECURITY_ENFORCED in Apex classes or triggers with an API version earlier than 45.0 is not recommended.

How to override New button in Salesforce Lightning Experience?

Use lightning:actionOverride in the aura:component to override standard actions in Salesforce Lightning Experience.

Sample Code:

  1. <aura:component implements="lightning:actionOverride" access="global" >  
  2.       
  3.     <b>You cannot create records from here!!!</b>  
  4.       
  5. </aura:component>  

Action Override:


Output:


Phone No and Email fields in Task and Event objects in Salesforce

Phone No and Email fields in Task and Event objects in Salesforce are not editable and are auto populated from the associated contact or lead record.

These are special fields as they pull the information of Phone and Email from either Contact or Lead.

Contains the phone number of the contact or lead related to the task. This field is filled in with the value from the related contact or lead record.



Activity Related To in Salesforce

Activities can be related to many objects Accounts, Opportunties, Contacts, leads, Custom Objects, etc.

Related To shows objects where Allow Activity is enabled and the user have at least read access to the object.


TIMEVALUE formula in Salesforce

TIMEVALUE function returns the time in GMT.

When the user select Date/Time field in Salesforce, they select it in their timezone. But, Salesforce saves that in GMT.


Usage of OrgLimit Class and OrgLimits Class

OrgLimit Class
The System.OrgLimit class contains methods that return the name, current value, and maximum limit for an instance.

getName() - Returns the limit’s name.
getValue() - Returns the limit usage value.
getLimit() - Returns the maximum allowed limit value.

OrgLimits Class
The System.OrgLimits class contains methods that return a list of all org limits or a map of all org limit names and values.

getAll() - Returns a list of OrgLimit instances.
getMap() - Returns a map of all OrgLimit instances with the limit name as key.

Sample Code:


  1. for ( OrgLimit o : OrgLimits.getAll() ) {  
  2.       
  3.     system.debug( o.getName() + ' - ' + o.getValue() + ' - ' + o.getLimit() );  
  4.       
  5. }  

Output: