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.