Object not found in Target Object in Global Actions in Salesforce

Currently, a Global Action cannot be added to an object if that object is on the Detail side of the Master-Detail relationship.

https://success.salesforce.com/ideaView?id=0873A000000CMPMQA4


So, if an object has Master Detail relationship, then that object will not be available for Global Action.

How to validate data before saving in lighting:recordForm?

Component:

<aura:component implements="force:appHostable" >

    <div class="slds-box slds-theme_default">        
        <lightning:recordForm recordId="001f200001XrzFQAAZ" 
                              objectApiName="Account"
                              layoutType="Full" 
                              mode="Edit" 
                              onsubmit="{!c.saveRec}"/>        
    </div>
    
</aura:component>

Controller:

({
saveRec : function(component, event, helper) {
        var eventFields = event.getParam("fields");
        var field = 'NumberOfEmployees';
        if (eventFields.hasOwnProperty(field)) {
            if ( !eventFields.NumberOfEmployees ) {            
                event.preventDefault();
                var toastEvent = $A.get("e.force:showToast");
                toastEvent.setParams({
                    "title": "Error!!!",
                    "message": "Please fill Employees field",
                    "type": "error"
                });
                toastEvent.fire();
            }
        }
}
})

Output:


How to view and handle Overdue Tasks in Salesforce?

Overdue Tasks in Salesforce Classic


Overdue Tasks in Salesforce Lightning Experience


What happens if time-dependent actions sets the trigger date to past date in Salesforce?

If Salesforce recalculates the time triggers to a date in the past, Salesforce triggers the associated actions shortly after you save the record.

If a workflow rule has a time trigger set for a time in the past, Salesforce queues the associated time-dependent actions to start executing within one hour. For example, if a workflow rule on opportunities is configured to update a field 7 days before the close date, and you create an opportunity record with the close date set to today, Salesforce starts to process the field update within an hour after you create the opportunity.

Sample Scenario to set Past Time:


How to create New Sub Folder in Salesforce Reports and Dashboards?

1. Go to Reports tab.

2. Select the Folder where you wan to create the Sub Folder.

3. Click New Folder inside the Parent folder.


Sample Sub Folder view in Salesforce


Moving reports and dashboards to different folders in Salesforce

On the Reports or Dashboards page, select Move from the row level action menu. A select folder dialog box opens where you can navigate to the destination folder and save.

1. Go to Reports tab.

2. Find the report and select Move from Row level actions.


Note:
Everyone can move reports and dashboards, but you can move them only to the folders and subfolders where you have write or edit access.

Passing Parameter to batch apex in Salesforce

Sample Code:

global class SampleBatchClassWithParams implements Database.Batchable<sObject>, Database.Stateful {

    private String strParameter;

    global SampleBatchClassWithParams(String strParam, Set < Id > setIds) {
        strParameter = strParam;
    }

    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SOQL';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List< sObject > scope) {
    }   

    global void finish(Database.BatchableContext BC) {
    }

}

Executing the Batch:

SampleBatchClassWithParams obj = new SampleBatchClassWithParams();
Database.executeBatch('test parameter', new Set < Id > {'001d000001W34vD'});

How to encode/decode URL in Salesforce Lightning component?

From Lightning component controller or helper:

var uri = "URI_Value";
var enc = encodeURI(uri);//to encode
var dec = decodeURI(enc);// to decode

From Apex:


Working with Records using REST API Salesforce

Sample Requests using Workbench:

Inserting Data Through REST API 

URL - /services/data/v20.0/sobjects/Employee__c/

Request Body:

{
"Employee__c":"Test",
"Age__c":19
}


View Data Through REST API with Specified Fields


/services/data/v20.0/sobjects/Employee__c/a00f200000Tfgpq?fields=Name,Employee_Name__c,Age__c

View Data Through REST API 

URL - /services/data/v20.0/sobjects/Employee__c/a00f200000TfgpqAAB


Knowledge not available in Lightning Experience

1. Switch to Classic.

2. Enable Lightning Knowledge.


New button is not appearing in Salesforce1

Check whether the object's New button is overridden by the Visualforce page.


If yes, then make sure your Visualforce page which overrides the "New" action on the object is marked as "Available for Lightning Experience, Lightning Communities, and the mobile app". To set this, in the setup menu, go to your visualforce page (Develop > Pages), open the Visualforce page there and there you will be able to set this checkbox.




lightning:checkboxGroup to display CheckBox in horizontal direction

Sample Code:

Component:

<aura:component implements="force:appHostable" >
    
    <aura:attribute name="options" type="List" default="[
    {'label': 'India', 'value': 'IN'},
    {'label': 'Unites States of America', 'value': 'US'},
    {'label': 'United Kingdom', 'value': 'UK'},
    {'label': 'Australia', 'value': 'AU'}
    ]"/>
    <aura:attribute name="selectedVal" type="List" default="IN"/>
    
    <div class="slds-box slds-theme_default">

     <lightning:checkboxGroup name="Checkbox Group"
                                 label="Checkbox Group"
                                 options="{! v.options }"
                                 value="{! v.selectedVal }"
                                 onchange="{! c.handleChange }"/>
    </div>
    

</aura:component>

Controller JS:

({
handleChange : function(component, event, helper) {
alert(component.get("v.selectedVal"));
}

})

Style css:

.THIS .slds-form-element__control {
   display: inline-flex;

}

Output:


Error ‘!LoadWizard.errorFileWrite!extract.csv’ when using Data Loader

The folder where the extract is being stored is not accessible, is corrupt or has not been selected.

To fix this; restart the Extract process, choose the object, and select a different folder\location to store the csv file.


Make sure you have Full access to the folder where you are trying to export the records.

How to restrict users login access based on country in Salesforce?

Transaction Security feature can be used to restrict users login access based on country in Salesforce.

To know about Transaction Security and setting up use the below link

http://www.infallibletechie.com/2016/11/transaction-security-in-salesforce.html

Sample Apex Code:

global class IndiaOnlySecurityPolicyCondition implements TxnSecurity.PolicyCondition {

    public boolean evaluate(TxnSecurity.Event e) {
        LoginHistory eObj = [SELECT CountryISO FROM LoginHistory WHERE Id = :e.data.get('LoginHistoryId')];
        if ( eObj.CountryISO == 'IN' ) {
            return false;
        }        
        return true; 
    }

}

The above code will allow only users to log in from Country India.

Note:
Please do not do this in Production. It may not allow you to log in if set incorrectly. Try to bypass system administrator profile to avoid issues.

How to troubleshoot or check Lightning for Gmail and Sync Status?

Note:
1. Check the email id of the user in the user details.

1. Go to Lightning for Gmail and Sync Settings.


2. Click Check button in Set Sync Settings and Check Status section.


3. Check the status.


4. To find the status for any individual user, select the user in User Sync Status and click Check Status.

How to create Connected Apps in Salesforce

1. Go to Apps.


2. Click New in Connected Apps section.


3. To get Client Secret and Client Id, set Enable OAuth Settings check box to true.


4. Use Consumer Key and Consumer Secret as Client Id and Client Secret.


To know about connected apps, check the below link

http://www.infallibletechie.com/2013/09/connected-apps-in-salesforce.html

How to get Access Token from Salesforce?

To get Access Token from Salesforce

URL - https://test.salesforce.com/services/oauth2/token or https://domain.my.salesforce.com/services/oauth2/token

Method - POST

Parameters:

username
password
client_id
client_secret
grant_type=password

To get client_id and client_secret, use the below link

http://www.infallibletechie.com/2018/05/how-to-create-connected-apps-in.html

From POSTMAN Client in Google Chrome


From SOAPUI

Resource - /services/oauth2/token


What is the use of Guage Component in Saleforce Report?

A gauge is used to see how far you are from reaching a goal. It displays a single value.

Knowledge Users Report


Say, you have Total Knowledge Users License Available is 10. We can use Guage component to see how many Knowledge licenses are utilized and how many are still remaining.


My Unresolved Items in Salesforce

When you use Salesforce for Outlook, Lightning Sync, or Email to Salesforce to sync items or add emails from your email app to Salesforce, any items that these features can’t automatically assign to Salesforce records appear in My Unresolved Items.


My Unresolved Items displays data from

1. Contacts
2. Events
3. Emails
4. Tasks

Salesforce Summer ’18 Release Highlights

Simplify Your Code with the Apex Switch Statement 
Apex now provides a switch statement that tests whether an expression matches one of several values and branches accordingly.

Apex switch statement expressions can be one of the following types.
Integer
Long
sObject
String
Enum

Sample Code:

switch on i {
   when 2 {
       System.debug('when block 2');
   }
   when -3 {
       System.debug('when block -3');
   }
   when else {
       System.debug('default');
   }

}

Create New Sub Folder in Salesforce Reports and Dashboards

http://www.infallibletechie.com/2018/06/how-to-create-new-sub-folder-in.html

lightning:recordForm
One of the most common requests from a custom user interface is to provide a form to view or edit a record. This functionality has now been boxed up for you as lightning:recordForm. With this base component, you can point to a record object (standard or custom) and have the form composed for you.

You can base the form on a layout (Full or Compact).

Set the mode attribute to view, edit, or readonly to specify the type of form. This form was created by specifying mode="edit" to add a record.

Update data with editable data tables in Lightning Component
lightning:dataTable has received a few improvements including the ability to mark a cell as editable. This allows you to flag specific data points that you want users to be able to update.

Sample Code:
cmp.set('v.contactcolumns', [
       {label: 'First Name', fieldName: 'FirstName', type: 'text', editable: true},
       {label: 'Last Name', fieldName: 'LastName', type: 'text', editable: true},
       {label: 'Email', fieldName: 'Email', type: 'text', editable: true}
       ]);

Account-Based Marketing Dashboard
The Account-Based Marketing dashboard helps marketing and sales work together to drive key accounts to close. Marketing can see overall pipeline and has insight into account-based sales activities. Sales can see the number of contacts engaged per account and which campaigns worked best to drive those connected personalized conversations.

Sales Cloud Einstein Mobility
Maximize every selling moment even when you are on the go with Sales Cloud Einstein Account and Opportunity insights now available on mobile.

Einstein Bots
Increase case deflection and reduce handle time with AI-powered chatbots. Natively built on the Salesforce platform, Einstein Bots can be set up declaratively and are pre-integrated into your CRM data and real-time channels. Use Einstein Bots to collect and qualify customer information to resolve routine issues or seamlessly escalate to an agent for fast resolution.

Omni-Channel Skills-Based Routing
Ensure that cases are always routed to the right agent, to solve the case the first time, with Omni-Channel skills-based routing. Automatically push cases to agents based on their skill set, availability, and capacity through the power of the Omni-Channel Routing engine.

Pre-Built Themes in Community Cloud
With pre-built themes, you can create a visually stunning experience for visitors, using clicks, not code. To create your experience, you can start from a library of pre-built themes in Lightning Community Builder. Plus, you can take advantage of themes for your existing communities, as well.

Community 360 Enhancements
With Community 360, agents can see what customers have been engaged in to deliver seamless service. The Summer '18 enhancements let agents see even more. Now, they can get a full view of customer interactions with assets, contracts, custom objects, orders, products, and tasks in the community.

Pinned Posts
Now, you can make sure that the most important information gets the right amount of attention within your community. With pinned posts, you can pin up to three posts to each topic or group feed.

Moving reports and dashboards to different folders in Salesforce

http://www.infallibletechie.com/2018/06/moving-reports-and-dashboards-to.html

Language Analyzer for Site Search in Commerce Cloud
Language analyzers are an important feature for site search. A language analyzer understands the characteristics of a specific language (like apostrophes, French accents, Greek characters, and more), and increases the relevancy of search results.

Mass Email Contacts and Mass Email Leads in Salesforce

1. Create an Email template and a list view. Make sure the list view is not reaching more than 10 records.

2. Go to Contacts tab for Mass Email Contacts and Lead tab for Mass Email Leads.



3. Select the list view.

4. Click Go.

5. Select the email template and click Send.

DML Operation in getter or setter method in Salesforce

You cannot use DML (Data Manipulation Language) operations in getter or setter methods in Salesforce.

The getter and setter are invoked either by your code, or if you are writing visualforce controllers, the getters are executed when the page is rendered and the setters are executed when a form is posted back to the controller. We cannot consider getter or setter method for doing DML operations in the code.

The "get" method is used to pass data from your Apex code to your Visualforce page. The "set" method is used to pass values from your Visualforce page to the controller.

Check the below link for more information

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_considerations.htm?search_text=dml

Scenarios that may cause "DML currently not allowed" are

1. Venturing a DML operation within a component controller where allowDML=false.

2. DML operation within a class constructor.

3. DML operation within a getter or setter.

Connect Salesforce from Spinify

Spinify is used to solve adoption and engagement issues by using its Lively Leaderboards.

To connect Salesforce from Spinify, check the below steps.

1. Go to Integrations in Spinify.


2. Click Salesforce Connect button.


3. Follow the link and install the AppExchange product.

4. Go to Spinify app in Salesforce after the installation and follow the steps to Sign In.

To Sync Salesforce Objects:


If you face any issue, please check the below link

https://help.spinify.com/integrations/integrate-with-salesforce/salesforce-app-setup

Onboarding & Assistance for Lightning Experience in Salesforce

Encourage Users to Work in Lightning Experience.

1. Go to Onboarding & Assistance.


2. Enable Onboarding & Assistance.


When the user is working in Salesforce Classic, the prompt appears for:

1. Any production org with Lightning Experience turned on
2. Any user who has the Lightning Experience User perm, which grants access to Lightning Experience

If your org hasn’t opted into extended Internet Explorer 11 support for Lightning Experience, anyone using IE11 doesn’t see this prompt.



Dynamic Owner for record creation in Process Builder in Salesforce


In the above example, if the Account Approver field is blank, the current user id is used as Owner Id else Account Approver will be the Owner Id for the case record.

How to deactivate Implicit Sharing when Sales Reps move within the organisation in Salesforce?

Implicit sharing is automatic. You can neither turn it off, nor turn it on. It is native to the Salesforce Platform. In other words, this isn't a configurable setting available in Salesforce.

To remove User's implicit access to the account, you have to remove his/her access to Opportunities, Cases, or Contacts under it. Develop a batch to take care of this.

Using Mass Transfer records will allow transferring Accounts, Opportunities, Contacts and Cases.

1. Go to Mass Transfer Records.


2. Click Transfer Accounts.


3. Select the appropriate options.


How to retrieve translations using Metadata API?

Sample Package.xml:

<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account</members>
        <members>AccountContactRole</members>
        <members>Activity</members>
        <members>Asset</members>
        <members>AssistantProgress</members>
        <members>Campaign</members>
        <members>CampaignMember</members>
        <members>Case</members>
        <members>CaseContactRole</members>
        <members>CaseMilestone</members>
        <members>Contact</members>
        <members>ContentVersion</members>
        <members>Contract</members>
        <members>ContractContactRole</members>
        <members>ContractLineItem</members>
        <members>DuplicateRecordItem</members>
        <members>DuplicateRecordSet</members>
        <members>Entitlement</members>
        <members>EntitlementContact</members>
        <members>Event</members>
        <members>FeedItem</members>
        <members>ForecastingAdjustment</members>
        <members>ForecastingCategoryMapping</members>
        <members>ForecastingOwnerAdjustment</members>
        <members>ForecastingQuota</members>
        <members>ForecastingTypeToCategory</members>
        <members>Idea</members>
        <members>Lead</members>
        <members>LiveAgentSession</members>
        <members>LiveChatTranscript</members>
        <members>LiveChatTranscriptEvent</members>
        <members>LiveChatTranscriptSkill</members>
        <members>LiveChatVisitor</members>
        <members>Macro</members>
        <members>MacroAction</members>
        <members>MacroInstruction</members>
        <members>Opportunity</members>
        <members>OpportunityCompetitor</members>
        <members>OpportunityContactRole</members>
        <members>OpportunityLineItem</members>
        <members>PartnerRole</members>
        <members>Pricebook2</members>
        <members>PricebookEntry</members>
        <members>Product2</members>
        <members>Question</members>
        <members>QuickText</members>
        <members>Quote</members>
        <members>QuoteLineItem</members>
        <members>Reply</members>
        <members>ServiceContract</members>
        <members>Site</members>
        <members>SocialPersona</members>
        <members>Solution</members>
        <members>StreamingChannel</members>
        <members>Task</members>
        <members>Territory2</members>
        <members>Territory2Model</members>
        <members>User</members>
        <members>UserProvisioningRequest</members>
        <members>UserTerritory2Association</members>
        <members>WorkBadge</members>
        <members>WorkBadgeDefinition</members>
        <members>WorkThanks</members>
        <members>*</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>*</members>
        <name>CustomObjectTranslation</name>
    </types>
    <version>36.0</version>
</Package>


How to give Network object access in Salesforce to a user?

1. Go to All Communities.


2. Select Workspace.


3. Select Administration.

4. In Members section, select the user profile so that the user will get access to Network Object.


How to set Calendar Sharing Settings in Salesforce?


1. Hide Details - Others can see whether the user is available at given times, but can not see any other information about the nature of events in the user’s calendar.

2. Hide Details and Add Events - In addition to the sharing levels set by Hide Details, users can insert events in other users’ calendars.

3. Show Details - Users can see detailed information about events in other users’ calendars.

4. Show Details and Add Events - In addition to the sharing levels set by Show Details, users can insert events in other users’ calendars.

5. Full Access - Users can see detailed information about events in other users’ calendars, insert events in other users’ calendars, and edit existing events in other users’ calendars.

Difference between component.find() component.get() in Salesforce Lightning

Component.get()

component.get(String key) and component.set(String key, Object value) retrieves and assigns values associated with the specified key on the component. Keys are passed in as an expression, which represents attribute values.

component.find()

find() returns different types depending on the result.

1. If the local ID is unique, find() returns the component.
2. If there are multiple components with the same local ID, find() returns an array of the components.
3. If there is no matching local ID, find() returns undefined.

component.find() works in a more broader way whereas component.get() is associated with attributes. find() method can be used to work on tags having same id's simultaneously.

How to get object sharing setting on Organization-Wide Defaults (OWD) using Apex?

Use the below query.

SOQL:

SELECT Id, DefaultAccountAccess, DefaultContactAccess, DefaultLeadAccess, DefaultOpportunityAccess FROM Organization


How to fix lightning sync status - User recognized by Google service account in Salesforce?

To fix lightning sync status - User recognized by Google service account in Salesforce, make sure the email address in the User detail is correct. It should be Gmail email address mapped to the GSuite account.

User Detail page:


Lightning Sync Status: