Thursday, March 14, 2019

Getting Started with Salesforce DX

Salesforce DX is a great way to let multiple peoples work together and also make deployment much easier. Salesforce DX make release cycle more efficient and easy. Version Control System become a source of truth rather than your salesforce.com org that is called source driven development. Each developer works in his personal scratch org and pushes code to the repository when necessary.
I struggled a little bit while adopting salesforce DX and hence writing all steps to get started with Salesforce DX.

  1. Installing Salesforce DX Tools

    1. Install the Saleforce Command Line Interface (CLI):- Follows steps given on following salesforce help page to install CLI according to your machine. https://developer.salesforce.com/docs/atlas.en-us.214.0.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm#sfdx_setup_install_cl
    2. Install Git:- Install git according to your machine from the following a link. https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
    3. Install VS code Editor:- Install VS code editor from https://code.visualstudio.com/
    4. Install Salesforce VS code plug-in:- Search for “Salesforce Extensions for VS Code” in vs code marketplace or install from https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode-apex

  1. Salesforce DX Setup

    1. Step-1 Enable Dev Hub. Dev Hub allows you to create and manage scratch org. Scratch orgs are disposable Salesforce orgs to support development and testing. Every developer can have their own scratch org and quickly created from command line along with deploying all metadata from source code repository. You can learn more about enabling Dev Hub from the following link. https://developer.salesforce.com/docs/atlas.en-us.214.0.sfdx_setup.meta/sfdx_setup/sfdx_setup_enable_devhub.htm. Developer Account can’t be enabled as dev Hub for now and for learning the purpose you can create Sign Up for a Developer Hub Trial Org. That will have Dev Hub enabled for you. https://developer.salesforce.com/promotions/orgs/dx-signup
    2. Login Into Deb Hub and authorize:- Use the <sfdx force:auth:web:login -d -a DevHub> command from CLI to authorize your salesforce Deb Hub using a web flow. Here -a for ALIAS and -d for default dev hub username
    3. Step-2 Setting up Salesforce DX project:- Depending upon where you are at your salesforce project stage. You will pick one of the following paths.
      1. Create brand new Salesforce Project:- force:project:create -n MyNewProject
      2. Checkout Project from GIT to start for existing salesforce :- Run following git command to checkout project from git.
        1. git clone <GIT Repo URL>
        2. Create Scratch org with command : sfdx force:org:create -s -f config/project-scratch-def.json -a <alias name>
        3. Push local source code to scratch org by sfdx force:source:push

Now you have pushed your local source and metadata to a scratch org. You can login into scratch org by <sfdx force:org:open> command and use it as your dev environment and keep your repo in sync.

References

  1. https://developer.salesforce.com/blogs/2018/02/getting-started-salesforce-dx-part-1-5.html
  2. App Development with Salesforce DX
  3. SFDX Command References
  4. Salesforce DX videos

Friday, February 23, 2018

Resolving WSDL File with external schemas In salesforce


Resolving WSDL File with external schemas In salesforce


One of them limitation of Salesforce “Generate from WSDL” is that it doesn’t support WSDL
files that imports external schemas.
For example, the following WSDL fragment imports an external schema, which is not supported
 <wsdl:types>  
  <xsd:schema  
   elementFormDefault="qualified"  
   targetNamespace="http://s3.amazonaws.com/doc/2006-03-01/">  
   <xsd:include schemaLocation="AmazonS3.xsd"/>  
  </xsd:schema>  
 </wsdl:types>  

When we upload a WSDL file that has imports an external schema then salesforce doesn’t parse WSDL and give following error in return.
Failed to parse wsdl: Found schema import from location XXX.xsd . External schema import not
supported

Workaround is to replace import statement with referenced schema. Here are steps.


  1. Open the WSDL with a text editor. 
  2. Inside <wsdl:types> (below the last <schema>) paste each referenced.xsd file content. Paste only <schema></schema>
  3. Once all schemas are in the WSDL then comment all <xsd:import> using <!-- → or remove them.  They are no longer needed.
  4. Save and you are ready to go.



Thursday, March 16, 2017

Preparing for Salesforce Community Cloud certification

I have been working on salesforce.com Communities from Partner/Customer portal days. Salesforce has evolved Communities a lot after announcing communities in Winter 13.  Recently salesforce.com announced Community cloud certification to recognize expertize in a particular area.  I spent two weeks to understand all available templates, community builder, community manager and refreshing my knowledge with respect to sharing and security (Common topic for all Salesforce Certifications) and prepared myself for exam. I finally took courage for exam and results were in my favour.  I am here sharing my experience and topics that i studies for exam apart from continue working as Salesforce.com Developer.
.
Here is the Credential Overview which is also available on the official Salesforce certification website:
------------------------------------------------------------------------------------------------------------------------------------------

The Salesforce Certified Community Cloud Consultant program is designed for consultants who have experience implementing and consulting on the Salesforce Communities applications in a customer-facing role. This credential is targeted toward the Salesforce Community Cloud Consultant or Partner who wants to demonstrate their skills and knowledge in designing, configuring, building, and implementing Salesforce Communities applications, using the declarative customization capabilities of the Communities platform.

The Salesforce Certified Community Cloud Consultant exam has the following characteristics:
  1. Content: 60 multiple-choice/multiple-select questions
  2. Time allotted to complete the exam: 90 minutes  
  3. Passing Score: 57%  
  4. Registration fee: USD 200; Retake fee: USD 100  
  5. Delivery options: Proctored exam delivered onsite at a testing center or in an online proctored environment.
  6. Prerequisite: Salesforce Certified Administrator credential


Here are topics that i covered while preparing for exam

  1. Complete Communities Basics trailhead to refresh knowledge about salesforce.com community
  2. Complete  Community Rollout Strategy trailhead, Exam has few questions around rollout planning.
  3. Complete Data Security Trailhead, exam has many questions around sharing rules in general and around communities.
  4. Read about community license types. There was question based on Community member persona.
  5. Evaluate steps required for Successful community rollout.
  6. Understanding My Domain concept and how to set up a custom domain for a Community.
  7. Sharing and Security concepts
    1. Sharing Rules
    2. Sharing sets
    3. Profiles and Roles
    4. Partner Roles
    5. Super User
  8. Determine the steps to build a public Community. Capabilities of the different templates. What does Napili have that Kokua does note for example?. There were lot of questions about picking right community templates.
  9. Demonstrate an understanding of the differences in sharing capabilities for partner, customer, and employee community users and articulate the impact of selecting a community license type on the sharing solution.
  10. Community Setup and Community Manager

    1. Determine the steps to expose appropriate tabs based on the needs of the Community constituents.

    2. Determine the steps to configure and set up topics, and map to the associated knowledge articles.

    3. Determine the steps to configure and set up Knowledge within a Community.

    4. Given the user access requirements, determine how to add members to a Community.

    5. Determine the steps to set up Community dashboards and insights.

    6. Explain Community moderation features.

    7. Given a scenario, determine the steps to create recommendations in a Community.

    8. Given a scenario, determine the steps to set up reputation levels in a Community.

    9. Enabling self registration and Social Sign on.
  11. Community Builder
    1. Determine how to customize a Community to match a company’s branding using Community Builder. Upload a logo to extract branding colors

    2. Determine how to customize navigation to given requirements in a template-based Community.

    3. Determine steps to create or customize web- or data-driven pages in Community Builder.

    4. Explain how to customize template components to given requirements.

  12. Look into record versions of Salesforce Community Cloud webinars

Friday, July 10, 2015

Troubleshooting Salesforce.com SSL Chaining Issue (IO Exception: sun.security.validator.ValidatorException: PKIX path building failed:)
In my recent project we were making outbound web service call-out to external system in 2 way secure environment. Everything works well till downstream environment certificate were updated as they are about to expire in couple of days. Once certificate were updated in downstream server and salesforce certificate was configured, we were getting error something like below.

IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

All other application which were connected to downstream environment was working fine but just salesforce had issue. We initially were in impression that it is salesforce.com side fault but it turnout as configuration issue at external system. I searched all around but didn't find much information how to resolve issue, all post I find was telling that it is configuration issue at server side which were right but how to diagnose it and be 100% sure. I discussed this issue with Dan Guggenheim (Our Technically Architect) and imagine he has already faced and figured out steps. Here are steps that we followed to diagnose problem.


Quick On-line Utility : Their is online utility at https://www.sslshopper.com/ssl-checker.html that will list certificate chain and tell if their is any issue if that doesn't work then try next.

Command Line tool :-
  1. Download the SSLPoke utility class that can be found at https://confluence.atlassian.com/download/attachments/218272870/SSLPoke.class?version=1&modificationDate=1275292817310&api=v2  and store it in your java classpath.
  2. From the command line, run:   java SSLPoke sapeservicesuat.domainname.com 443
  3. If the ssl configuration is correct, you should see:  Successfully connected
  4. If there are problems, you will probably see the unable to find valid certification path to requested target exception, or something similar
  5. To get more details, add another argument to the SSLPoke command:  java -Djavax.net.debug=ssl SSLPoke sapeservicesuat.domainname.com 443.  You may need to redirect the output to a text file so you can search it later ( add > fileName.txt>.
  6. As you review the output, look for the certificate chain.  It looks something like this (notice chain[0],chain[1]:
chain [0] = [
[
 Version: V3
 Subject: CN=sapeservicesuat.domainname.com, OU=IT, O=Sapient Corporation, L=Boston, ST=Massachusetts, C=US
 Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

 Key:  Sun RSA public key, 2048 bits
 public exponent: 65537
 Validity: [From: Thu Jan 30 05:30:00 IST 2014,
              To: Fri Feb 20 05:29:59 IST 2015]
 Issuer: CN=Thawte SSL CA, O="Thawte, Inc.", C=US
 SerialNumber: [    7391c10b 37f0d22e 15dcabf3 355cabde]

Certificate Extensions: 8
[1]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
 [
  accessMethod: ocsp
  accessLocation: URIName: http://ocsp.thawte.com
,
  accessMethod: caIssuers
  accessLocation: URIName: http://svr-ov-aia.thawte.com/ThawteOV.cer
]
]

[2]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: A7 A2 83 BB 34 45 40 3D   FC D5 30 4F 12 B9 3E A1  ....4E@=..0O..>.
0010: 01 9F F6 DB                                        ....
]
]

[3]: ObjectId: 2.5.29.19 Criticality=false
BasicConstraints:[
 CA:false
 PathLen: undefined
]

[4]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
 [DistributionPoint:
]]

[5]: ObjectId: 2.5.29.32 Criticality=false
CertificatePolicies [
 [CertificatePolicyId: [2.16.840.1.113733.1.7.54]
[PolicyQualifierInfo: [
 qualifierID: 1.3.6.1.5.5.7.2.1
 qualifier: 0000: 16 1B 68 74 74 70 73 3A   2F 2F 77 77 77 2E 74 68  ..https://www.th
0010: 61 77 74 65 2E 63 6F 6D   2F 63 70 73 2F          awte.com/cps/

]]  ]
]

[6]: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
 serverAuth
 clientAuth
]

[7]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
 DigitalSignature
 Key_Encipherment
]

[8]: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
]

]


]
chain [1] = [
[
 Version: V3
 Subject: CN=Thawte SSL CA, O="Thawte, Inc.", C=US
 Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

 public exponent: 65537
 Validity: [From: Mon Feb 08 05:30:00 IST 2010,
              To: Sat Feb 08 05:29:59 IST 2020]
 Issuer: CN=thawte Primary Root CA, OU="(c) 2006 thawte, Inc. - For authorized use only", OU=Certification Services Division, O="thawte, Inc.", C=US
 SerialNumber: [    4d5f2c34 08b24c20 cd6d507e 244dc9ec]

Certificate Extensions: 7
[1]: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
 [
  accessMethod: ocsp
  accessLocation: URIName: http://ocsp.thawte.com
]
]

[2]: ObjectId: 2.5.29.35 Criticality=false
AuthorityKeyIdentifier [
KeyIdentifier [
0000: 7B 5B 45 CF AF CE CB 7A   FD 31 92 1A 6A B6 F3 46  .[E....z.1..j..F
0010: EB 57 48 50                                        .WHP
]
]

[3]: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
 CA:true
 PathLen:0
]

[4]: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
 [DistributionPoint:
]]

[5]: ObjectId: 2.5.29.15 Criticality=true
KeyUsage [
 Key_CertSign
 Crl_Sign
]

[6]: ObjectId: 2.5.29.17 Criticality=false
SubjectAlternativeName [
 CN=VeriSignMPKI-2-9
]

[7]: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: A7 A2 83 BB 34 45 40 3D   FC D5 30 4F 12 B9 3E A1  ....4E@=..0O..>.
0010: 01 9F F6 DB                                        ....
]
]

]
]
chain [2] = [
[
 Version: V3
 Subject: CN=thawte Primary Root CA, OU="(c) 2006 thawte, Inc. - For authorized use only", OU=Certification Services Division, O="thawte, Inc.", C=US
 Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5

]
***
]

If you only see one entry in the chain, that is usually a pretty good indication that the server is not presenting the correct sequence of certs. Salesforce.com is very particular about certificate chaining and server must must send intermediate certificate in the correct order.The correct order is:

  1. Server certificate.
  2. Intermediate certificate that signed the server certificate if the server certificate was not signed directly by a root certificate.
  3. Intermediate certificate that signed the certificate in step 2.
  4. Any remaining intermediate certificates. Do not include the root certificate authority certificate. The root certificate is not sent by your server.

in my case, we just compare what order server was presenting before updating certification what is wrong after it is updated and got issue in second approach.

Getting Started with Salesforce DX

Salesforce DX is a great way to let multiple peoples work together and also make deployment much easier. Salesforce DX make release cycle m...