Communities Self-Registration Visualforce Page

Below components are available in default for Communities Self-Registration

Visualforce Page: CommunitiesSelfReg

Apex Class: CommunitiesSelfRegController

Test Class: CommunitiesSelfRegControllerTest

Cheers!!!

The reference to entity "oid" must end with the ';' delimiter.

To fix  " The reference to entity "oid" must end with the ';' delimiter.", use &amp instead of & symbol in the URL.

Sample URL:

https://test-dev-ed--c.na30.content.force.com/servlet/servlet.ImageServer?id=01536000001ZLBP&oid=00D36700000aU1

Cheers!!!

How to Close a Case from Salesforce1 mobile app?

1. Go to Buttons, Links, and Actions under Case.


2. Click "New Action".


3. Enter and select the details. Click "Save" button.


4. Drag and Drop the fields and click "Save" button.


5. Click New under Predefined Values.


6. Select as per the below image and click "Save" button.


7. Go the Case page layout.

8. Edit it.

9. Click override the predefined actions link.


10. Drag and Drop the quick action created under Salesforce1 and Lightning Experience Actions.


11. Go to Salesforce1 Mobile App.

12. Open a Case.

13. Tap Close Case.


14. Enter the details and click "Save".


Output:



Cheers!!!

How to show Closed Status in Case Edit page?

1. Go to Support Setting.


2. Enable "Show Closed Statuses in Case Status Field".


Cheers!!!

Lightning components in community builder

To use Lightning components in community builder, use implements="forceCommunity:availableForAllPageTypes".

Sample Code:

<aura:component implements="forceCommunity:availableForAllPageTypes">

</aura:component>

Cheers!!!

How to import project from Microsoft TFS Server to Eclipse?

1. Go to File --> Import.


2. Select Team --> Projects from Team Foundation server.


3. Select the Project.


4. Select the Repository.


5. Go to Force.com Properties.


6. Enter your credentials.

Cheers!!!

How to check in Salesforce component changes using Microsoft TFS?

1. Right click the component to check in and select Check-In Pending Changes.


2. Enter the comments and click "Check-In".


Note:
Once the changes are committed to the Server, the white tick mark will be changed to yellow cylindrical symbol.

Cheers!!!

How to see Version History in Microsoft TFS?

1. Select Version History under the component.


2. Compare or view the changes.


Cheers!!!

How to redirect to site.com page in Salesforce Community?

1. Get the community URL.


2. In Apex, construct the URL as below

Community URL/s/Site.com Page Name

Check the below link for more information

https://help.salesforce.com/apex/HTViewSolution?id=000193894&language=en_US

Cheers!!!

How to activate Community in Salesforce?

1. Go to All Communities.


2. Click Manage link under the Community which you want to activate.

3. Under Administration, select Settings and click "Activate Community".


Cheers!!!

How to publish the Community?

1. Go to All Communities.


2. Click Manage link under which Community you want to publish.

3. Select Go to Community Builder.


5. Click "Publish" button.

Cheers!!!

How to run Scheduler class instantly?

Sample code:

SchedulerClass obj = new SchedulerClass();
obj.execute(null);

Cheers!!!

How to avoid duplicate in Custom object in Salesforce?

1. Go to Matching Rules.


2. Click New, select the object, Enter the Details and Save the rule.



3. Activate the Matching Rule.


4. Go to Duplicate Rules.


5. Create and save the Duplicate rule by selecting the matching rule created in the previous steps.


6. Activate the Duplicate Rule.


Output:


Cheers!!!

How to iterate map in Salesfore Lightning?

Apex Class:

public class LightningController {
    @AuraEnabled
    public static Map < String, String > fetchMapData() {
        Map < String, String > mapCustomer = new Map < String, String >();
        mapCustomer.put('Sample', 'Value');
        mapCustomer.put('Sample1', 'Value1');
        mapCustomer.put('Sample2', 'Value2');
        mapCustomer.put('Sample3', 'Value3');
        system.debug(mapCustomer);         
        return mapCustomer;
    }
}

Component:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" controller="LightningController">
    <ui:button label="Fetch" press="{!c.fetch}"/>
    <br/><br/>
    <aura:attribute name="showBool" type="Boolean" default="false"/>
    <aura:attribute name="customers" type="List" />
    <aura:renderIf isTrue="{!v.showBool}">
        <aura:iteration items="{!v.customers}" var="cus" indexVar="key">
            {!cus.key} - {!cus.value}<br/><br/>
        </aura:iteration>
    </aura:renderIf>
</aura:component>

Controller:

({
fetch : function(component, event, helper) {
        var custNo = component.get("v.custNo");
var action = component.get("c.fetchMapData");   
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {                
                var custs = [];
                var conts = response.getReturnValue();
                for ( var key in conts ) {
                    custs.push({value:conts[key], key:key});
                }
                component.set("v.customers", custs);
                component.set("v.showBool", true);
            } 
});           
        $A.enqueueAction(action); 
}
})

App:

<aura:application >
    <c:MapComponent/>

</aura:application>

Output:


Cheers!!!

Simple REST API for XML response in Salesforce

Sample code:

Map < String, String > mapCustomer = new Map < String, String >();
String endpoint = 'http://www.thomas-bayer.com/sqlrest/CUSTOMER/1/';
HTTP h = new HTTP();
HTTPRequest req = new HTTPRequest();
req.setEndPoint(endpoint);
req.setMethod('GET');
HTTPResponse res = h.send(req);
Dom.Document doc = res.getBodyDocument();
Dom.XMLNode customer = doc.getRootElement();
for(Dom.XMLNode child : customer.getChildElements()) {
       mapCustomer.put(child.getName(), child.getText());
}
system.debug(mapCustomer);

Cheers!!!

System.CalloutException: Method can not be null

If you face System.CalloutException: Method can not be null issue, make sure you are using POST Or GET Or PUT in your request.

Sample Code:

        HTTPRequest req = new HTTPRequest();
        req.setEndPoint('End Point URL');
req.setMethod('GET');

Cheers!!!

How to share Salesforce project to TFS?

1. Right click the project and select Share Project.


2. Select Team Foundation Server.


3. Select the server.


4. Select the Location.

5. Click "Finish".

6. Check In the components after sharing. To Check In, right click the project folder, select Team --> Check In Pending Changes.


Cheers!!!

Team Share Project disabled

If Team --> Share  Project is disabled, open the project.

Right Click the project in the Project Explorer and click "Open Project" to open the project and avoiding Share Project option disabled.

Cheers!!!

Features not available for external objects in Salesforce

To know the features that are not available for external objects in Salesforce, check the below link

https://help.salesforce.com/HTViewHelpDoc?id=platform_connect_considerations_compatibility.htm

Cheers!!!

How to avoid duplicate account creation in Salesforce?

1. Go to Matching Rules.


2. Activate the standard rules.


3. Go to "Duplicate Rules".


4. Click New and select the object. I have selected Account for this example.


5. Enter the details and save.


6. Activate the Duplicate Rule.


Output:


Cheers!!!

Formula field to find the last day of the month in Salesforce?

Sample Formula code:

IF( MONTH( TODAY() ) = 12, 
DATE( YEAR( TODAY() ), 12, 31 ), 
DATE( YEAR( TODAY() ), MONTH( TODAY() ) + 1, 1) - 1)

Cheers!!!

How to cover the test coverage for getURL method?

To cover the test coverage for getURL method, use Test.setCurrentPage(Page.PageName).

Test.setCurrentPage(Page.PageName) will help you to cover the codes which makes use of ApexPages.currentPage().getUrl().

Cheers!!!

Formula field to find day of the week in Salesforce?

Sample code:

CASE( 
MOD(TODAY() - DATE(1900, 1, 7), 7), 
1, 'Sunday', 
2, 'Monday', 
3, 'Tuesday', 
4, 'Wednesday', 
5, 'Thursday', 
6, 'Friday', 
'Saturday' 
)


Cheers!!!

Health Check in Salesforce

Health Check lets you identify and fix security vulnerabilities in your password policies, network access configuration, and session settings, all from a single page. A summary score shows how your org measures against the Salesforce-recommended baseline.

Go to Security Controls --> Health Check.


Cheers!!!

Lightning Connect

Lightning Connect provides seamless integration of data across system boundaries by letting your users view, search, and modify data that’s stored outside your Salesforce organization. For example, perhaps you have data that’s stored on premises in an enterprise resource planning (ERP) system. Instead of copying the data into your org, you can use external objects to access the data in real time via web service callouts.

Check the below link for step by step process to implement

http://www.infallibletechie.com/2016/05/how-to-view-external-data-in-saleforce.html

Cheers!!!

Lightning Basic UI Elements

Sample Code:
Component Code:
<aura:component >
    <!--<aura:attribute name="newAccount" type="Account"/>
    <ui:inputText label="Account Name" value="{!v.newAccount.Name}"/>
    <ui:inputText label="Account Number" value="{!v.newAccount.AccountNumber}"/>
    <ui:button label="Create Account" />-->
    <ui:inputText label="Text Box"/><br/><br/>
    <ui:inputCheckBox label="Check Box"/><br/><br/>
    <ui:inputNumber label="Number"/><br/><br/>
    <ui:inputDateTime label="Date and Time"/><br/><br/>
    <ui:inputDate label="Date"/><br/><br/>
    <ui:inputDateTime label="Date and Time with Date Picker" displayDatePicker="true"/><br/><br/>
    <ui:inputDate label="Date with Date Picker" displayDatePicker="true"/><br/><br/>
    <ui:inputRadio label="Radio Button"/><br/><br/>
    <ui:inputSelect label="Single Pick List">
        <ui:inputSelectOption text="Red"/>
        <ui:inputSelectOption text="Green" value="true"/>
        <ui:inputSelectOption text="Blue"/>
</ui:inputSelect><br/><br/>
    <ui:inputSelect multiple="true" label="Multi Pick List">
        <ui:inputSelectOption text="All Primary" label="All Contacts"/>
        <ui:inputSelectOption text="All Primary" label="All Primary"/>
        <ui:inputSelectOption text="All Secondary" label="All Secondary"/>
    </ui:inputSelect><br/><br/>
    <ui:button label="Button"/>    
</aura:component>

App Code:
<aura:application >
    <c:AccountFormComponent/>
</aura:application>

Output:


Cheers!!!

How to call Future methods from Process Builder?

To call Future methods from Process Builder, call the future method from the in-vocable method. Check the below code.

Sample Code:

public class LightningProcessBuilder {
    @InvocableMethod 
    public static void sendEmailToOwner(List<String> listUserNames) {
        callEmailSend(listUserNames);
    }
    @future
    public static void callEmailSend(List<String> listUserNames) {
        //Write the logic.
       //If it is a call out, use callout = true in future annoation
    }
}

Cheers!!!

How to check supported currencies in Salelsforce organization?

Go to Company Profile --> Manage Currencies.


The Active Currencies sections show the supported currencies in Salelsforce organization.

Cheers!!!