GitHub Integration with Salesforce

GitHub

As developers, we want to collaborate code with our peers and other developers. GitHub is an online software development platform. It’s used for storing, tracking, and collaborating on software projects.

The steps shown below needs a VS Code project with manifest ( package.xml) file and existing code

Step 1: Sign in to your GitHub account.

Create a Project Repository by logging into your GitHub account, as shown in the image below (keep its access private).

Step 2: Clone the GitHub repository locally on your machine

Install this Extension in your VS Code

On your local computer, install Git. Clone the primary GitHub repository once you’re finished.

I followed the following git commands on VS Code Terminal window. Please note the git repository url needs to be updated to your own git url

git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/<test-name>/>repo-name-test.git
git push -u origin main

As soon as you execute the commands mentioned above, your code base will be uploaded to github repository

Right now, only 1 master branch is available and all the changed will be committed to master branch

In subsequent posts, we will see how can we automate CI/CD process for salesforce

Permanent link to this article: https://salesforcebuddy.com/2023/03/github-integration-with-salesforce/

Declarative Lookup Rollups Summaries – Part 1

We all must have seen rollup summary fields in Master-Detail objects. We can not have Master-Detail relationship at all places but there is often a need to calculate rollup where 2 objects are related by a lookup field. Declarative Lookup Rollup Summaries, or DLRS, are perfect for creating rollup fields for objects that are not related through lookup relationships. DLRS allow for calculations between any parent and child objects and they have a variety of calculations such as rolling up the most recent or least recent records, giving total counts, giving the sum of a child record’s numeric fields, or even concatenating child field values onto the parent record. You can also add criteria to further filter which records should be evaluated in the rollup.

To get started, first make sure you have the DLRS package installed in your org. You can install it by clicking here.

Once the installation is done, you can create your rollups.

We will go over the different configuration in the next blog.

Permanent link to this article: https://salesforcebuddy.com/2022/01/declarative-lookup-rollups-summaries-part-1/

Converting collections in apex

List<Id> to List<String>

// Convert List<Id> to List<String> 
List<Id> ids = new List<Id>{ '0011b00000v3UeD', '0011b00000wUJSs' };
List<String> strings = new List<String>( (List<String>)ids );

Set<Id> to Set<String>

// Convert Set<Id> to Set<String>
Set<Id> idSet = new Set<Id>{ '0011b00000v3UeD', '0011b00000wUJSs' };
Set<String> stringSet = new Set<String>( (List<String>)new List<Id>( idSet ) );

List<String> to List<Id>

// Convert List<String> to List<Id>
List<String> stringList = new List<String>{ '0011b00000v3UeD', '0011b00000wUJSs' };
List<Id> idList = new List<Id>( (List<Id>)stringList );

Set<String> to Set<Id>

// Convert Set<String> to Set<Id>
Set<String> stringSet2 = new Set<String>{ '0011b00000v3UeD', '0011b00000wUJSs' };
Set<Id> idSet2 = new Set<Id>( (List<Id>)new List<String>( stringSet2 ) );

Set to List of same data type

Set<String> stringSet = new Set<String>{'abc','xyz'};
 
List<String> listStrings = new List<String>(stringSet);

List to Set of same data type

List<String> stringList= new List<String>{'abc','def'};

Set<String> setStrings = new Set<String>(stringList);

Permanent link to this article: https://salesforcebuddy.com/2021/04/converting-collections-in-apex/