Thursday, May 2, 2019

CI/CD Salesforce model

Hi All,

So many of you are wondring how to have a CI/CD model implemented with Salesforce. There are many options:

  1. SFDC
  2. Custom AppExchange products(using some sort of version controll and handing access to that repository to the app)
  3. Custom
I am going to share a flavor of the 3rd option below.

Your setup needs will be:
  1. Git repository that is published with internet access
  2. Jenkins that is published with internet access 
  3. Ant/JAVA setup within Jenkins
  4. Salesforce creds.
Your working path will be:
  1. Developer connects with git repository and make the code changes and then commit the code in git.
  2. Git will fire Jenkins job that will deploy the code into another org.
Click the below gif to see demo.

Tuesday, February 13, 2018

Salesforce DX initial guide

Salesforce DX is a VCS from alesforce, if you are working on collaborative projects with a multiple developer then you may need to use git along side with DX.

To start we need to have a Dev Hub org, you will use this to control all your scratch orgs, also you will need Salesforce CLI installed in your local machine.

1. Command to login and authenticate your dev hub user.
sfdx force:auth:web:login --setdefaultdevhubusername --setalias devhub
If you have used only "sfdx force:auth:web:login" then use the below comman to set user to default
sfdx force:config:set defaultusername=test-wvkpnfm5z@example.com --global
Note: find the user list: sfdx force:user:list

2. Download the package from dev hub, you may have some other org as a source also.
sfdx force:mdapi:retrieve -r ./mdapipkg -u <username> -k ./package.xml

3. Convert it to DX project style
sfdx force:mdapi:convert --rootdir mdapipkg/unpackaged

4. Create a scratch org
sfdx force:org:create -f project-scratch-def.json -a devhub

5. Check org and user name
sfdx force:org:list

6. Push the local change to scratch org to start development.
sfdx force:source:push -u <scratchusername>
Repeat point 6 when ever you make any changes in local.

7. Pull changes from your scratch
sfdx force:source:pull -u <scratchusername>

Wednesday, November 2, 2016

How to get site user in debug logs Winter17

So after winter17 we cannot see site user debug as a salesforce update.

To enable that we have to set cookies in user browser.

In chrome open inspect element>console and paste this.
Document.cookie="debug_logs;domain=.force.com";

Thursday, July 28, 2016

Apex inputField issue with dataTable,pageBlockTable and repeat

When working with <apex:inputField> inside dataTable,pageBlockTable with wrapper objects you have to use <apex:column> if you donot use it visualforce pahe will result inot an error saying

"<apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable."

To over come this you have to use <apex:inputField> inside <apex:column> or you can use <apex:repeat> instead, when you use <apex:repeat> you have to design the table structure yourself.

Monday, July 18, 2016

Using Salesforce SOAP API in Ajax

Just a small post(its a very old functionality but I just posted it now) for how to create record using /soap/ajax/ in Salesforce. The code can be written in Visualforce page as well as Custom button as javascript.

Reference: SOAP API

Usage:
  1. Can be used to create record like logs or attachments from javascript hence reducing server processing time.
  2. Can query record to check values in page layout buttons.