GIT Bitucket for Salesforce Version Control

1. Go to https://git-scm.com/downloads.

2. Select the Operating System to download the GIT.


3. Check whether it was installed properly.


4. Configure GIT in your PC.


5. Create a repository in Bitbucket.

6. Create a folder in your computer.

7. Navigate to that folder using command prompt. This folder will be your local repository for master branch(Production).


8. Clone the repository into your local repository.

git clone https://REPOSITORYURL.git

9. Use Force.com IDE or ANT or any other tool and get all the metadata. I have used Eclipse with Force.com IDE.


10. Move the extract to the local repository folder.


11. Run the below commands one by one.

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin https://REPOSITORYURL.git
git push -u origin master

12. Go to Bitbucket and create a branch from existing master branch.


I have created a branch called FullSandbox.

13. In your computer create a folder for this branch. I have created with the name FullSandbox.

14. Download and install TortoiseGit.

15. Navigate to that folder created in step 13.

16. Right Click and select Git Clone.


12. Enter the URL and enter the branch name.


This will be your local repository for FullSandbox branch.

13. Use Force.com IDE or ANT or any other tool and get all the metadata from Full sandbox. I have used Eclipse with Force.com IDE.

14. Move it to the directory.(Replace the files which are already existing since it is from master branch(production)).

15. Right click


16. Click Commit button. This will commit to local repository.

17. Click Push button. This will push it to the remote repository.

18. Do the same steps 13 to 17 for all the branches. Below is for Production. Make sure you have the latest refreshed metadata using Force.com IDE or ANT or any other tool.


Multiple Emails separated by coma validation rule in Salesforce

Syntax:

  1. OR(   
  2. NOT(   
  3. REGEX( Emails__c , "([a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z,]{2,4})*")   
  4. ),   
  5. RIGHT( Emails__c , 1 ) = ","   
  6. )  


How to create a simple Project and Run in MuleSoft Anypoint studio?

1. Go to File --> New --> Mule Project.


2. Enter a Name and click "Finish" button.


3. Drag and Drop HTTP Listener, Set Payload and Logger from the Mule Palette.

4. Click + button in Connector Configuration in the Listener.


5. Leave as it and click OK button.


6. Enter the path details.


7. Enter Payload value.


8. Run the project. Right click and select Run project sample.


9. Go to http://localhost:8081/sample. Open the downloaded file.




Lighting Data Table Sorting while we are using hyper link with Label

Sample Code:

Component:

  1. <aura:component implements="force:appHostable"  
  2.        controller="AccountListController">  
  3.                   
  4.     <aura:attribute type = "Account[]" name = "acctList"/>  
  5.     <aura:attribute name = "mycolumns" type = "List"/>  
  6.     <aura:attribute name = "sortedBy" type = "String" default = "Name"/>  
  7.     <aura:attribute name = "sortedDirection" type = "String" default = "asc"/>  
  8.       
  9.     <aura:handler name = "init" value ="{! this }" action = "{! c.fetchAccounts }"/>  
  10.       
  11.     <lightning:datatable data = "{! v.acctList }"   
  12.                          columns = "{! v.mycolumns }"   
  13.                          keyField = "id"  
  14.                          hideCheckboxColumn = "true"  
  15.                          onsort = "{! c.updateColumnSorting }"  
  16.                          sortedBy = "{! v.sortedBy }"    
  17.                          sortedDirection = "{! v.sortedDirection }"/>  
  18.       
  19. </aura:component>  

Component Controller:

  1. ({  
  2.       
  3.     fetchAccounts : function( component, event, helper ) {  
  4.           
  5.         component.set( 'v.mycolumns', [  
  6.             {label: 'Account Name', fieldName: 'linkName', type: 'url', sortable: true,   
  7.             typeAttributes: {label: { fieldName: 'Name' }, target: '_blank'}},  
  8.             {label: 'Industry', fieldName: 'Industry', type: 'text', sortable: true},  
  9.             {label: 'Type', fieldName: 'Type', type: 'Text'}  
  10.         ] );  
  11.         var action = component.get( "c.fetchAccts" );  
  12.         action.setParams({  
  13.         });  
  14.         action.setCallback(this, function( response ){  
  15.             var state = response.getState();  
  16.             if ( state === "SUCCESS" ) {  
  17.                 var records =response.getReturnValue();  
  18.                 records.forEach( function( record ){  
  19.                     record.linkName = '/' + record.Id;  
  20.                 });  
  21.                 component.set( "v.acctList", records );  
  22.                 helper.sortData( component, component.get( "v.sortedBy" ), component.set( "v.sortedDirection" ) );  
  23.             }  
  24.         });  
  25.         $A.enqueueAction(action);  
  26.           
  27.     },  
  28.       
  29.     updateColumnSorting: function (cmp, event, helper) {  
  30.           
  31.         var fieldName = event.getParam( 'fieldName' );  
  32.         cmp.set( "v.sortedBy", fieldName );  
  33.         if ( fieldName === 'linkName' )  
  34.             fieldName = 'Name';  
  35.         var sortDirection = event.getParam( 'sortDirection' );  
  36.         cmp.set( "v.sortedDirection", sortDirection );  
  37.         helper.sortData( cmp, fieldName, sortDirection );  
  38.           
  39.     }  
  40.   
  41. })  

Component Helper:

  1. ({  
  2.       
  3.     sortData: function ( cmp, fieldName, sortDirection ) {  
  4.           
  5.         var data = cmp.get( "v.acctList" );  
  6.         var reverse = sortDirection !== 'asc';  
  7.         data.sort( this.sortBy( fieldName, reverse ) )  
  8.         cmp.set( "v.acctList", data );  
  9.           
  10.     },  
  11.       
  12.     sortBy: function ( field, reverse, primer ) {  
  13.           
  14.         var key = primer ?  
  15.             function( x ) { return primer( x[ field ] ) } :  
  16.             function( x ) { return x[ field ] };  
  17.         reverse = !reverse ? 1 : -1;  
  18.         return function ( a, b ) {  
  19.               
  20.             return a = key( a ), b = key( b ), reverse * ( ( a > b ) - ( b > a ) );  
  21.               
  22.         }  
  23.           
  24.     }  
  25.       
  26. })  

Apex Class:

  1. public class AccountListController {    
  2.         
  3.     @AuraEnabled    
  4.     public static List < Account > fetchAccts() {    
  5.             
  6.         return [ SELECT Id, Name, Industry, Type, CreatedDate  
  7.                    FROM Account   
  8.                   LIMIT 100 ];    
  9.             
  10.     }      
  11.         
  12. }  

Output:



How to download and set up Mulesoft Anypoint Studio?

Anypoint Studio is used to build and test APIs and integrations with Anypoint Platform’s desktop IDE.

Download and setup JAVA:

1. Make sure JAVA is installed. Use java -version to check it.


2. Go to System Variable in Environment Variables and make sure that the JDK 1.8.0/bin directory is the first item in your PATH environment variable.


Download and setup Mulesoft Anypoint Studio:

1. Go to https://www.mulesoft.com/platform/studio.

2. Download the Studio.

3. Extract the downloaded file.

Note:
Extract it into the 'C:\' root folder.

4. Open the extracted folder.

5. Create a folder with the name Workspace.

6. Double-Click AnyPointStudio.


7. Select the Workspace folder created in Step 5.


Getting Started With MuleSoft

What is Mule?

Mule, the runtime engine of Anypoint Platform, is a lightweight Java-based enterprise service bus and integration platform that allows developers to connect applications together quickly and easily, enabling them to exchange data.

What is middleware.

Software that acts as a bridge between and operating system or database and applications, especially on a network.

What is SOA?

Service Oriented Architecture is a set of principles and methodologies to design and develop well-defined business functionalities that are built as software components that can be reused.

What is an ESB?

An Enterprise Service Bus implements a communication system between mutually interacting software applications in a service-oriented architecture(SOA).

What is an API?

An API defines what you can call, what you send it, and what you get back.

What is a Web Service?

The actual API implementation you can make calls to or the interface of that API implementation.
A web service is a method of communication that allows two software systems to exchange data over the internet.

What is an API Proxy?

An application that controls access to a web service, restricting access and usage through the use of an API gateway.

What are the parts of a web service?

i. Web Service API
Describes how you interact with the web service.
ii. Web Service interface implementing the API
Is the code providing the structure to the application so it implements the API.
iii. The Web Service implementation itself
Is the actual code and application.

Define JSON?

A lightweight data-interchange format.

What is an API Portal?

When a REST API is added to Exchange, an API portal is automatically created for it.

An API portal has
i. Auto-generated API documentation
ii. An API Console for consuming and testing APIs
iii. An automatically generated API endpoint that uses a mocking service to allow the API to be tested wthout having to implement it.

REST Connectors in Anypoint Exchange

When a RAML 1.0 API specification is added to Exchange, a connector is automatically created for it.
i. The connector can be used in Mule applications to make calls to that API.
ii. REST Connect is the name of the technology that performs this conversion.

Flow Designer

Web app for building integration apps that connect systems and consume APIs.

API Designer

Web app for designing, documenting and mocking APIs.

Anypoint Studio

Desktop IDE for implementing APIs and building integration applications.

MUnit

MUnit is a Mule app testing framework for building automated tests.
MUnit is fully integrated with Anypoint Studio.

RAML

RESTful API Modeling Language.
A simple, strutured and succinct way of describing RESTful APIs.
RAML files can be used to auto-geerate documentation, mocked endpoints, interfaces for API implemenations and more.

RAML Syntax

RAML is based on broadly-used standards such as YAML and JSON.
Uses a human-readable data serialization format where data structure hierarchy is specified by indendation.