Salesforce Trailhead “Challenge not yet complete” most common cause

Ah, Spring is in the air. So are arms, as people new to Salesforce throw them up during Trailhead challenges where they can’t seem to get the hands-on part to pass even though they see the result they expect.

The Trailhead modules and Superbadges are so well organized and written, it may seem like there is an instructor reviewing you submissions, but that would not be practical, profitable, or in the spirit of a cloud platform. The scoring is done by automated tests that are checking that things match exactly as the instructions provided.

The most common cause is that the learner has mis-typed a value provided, usually the API name (i.e., my_variable__c). Runner up to this is the experienced user who is new to Trailhead and uses their own naming conventions rather than following the instructions (been there, done that).

The third common cause is that the module content was updated but the test was not (doesn’t happen that often, but you can tell when there are a bunch of questions on the Trailhead Community about the same problem).

HTH

Facebooktwitterredditlinkedinmail
© Scott S. Nelson

How to re-assign Salesforce object ownership in bulk

Here is a question I see frequently in the Trailhead Community: How do you re-assign the ownership of objects in bulk? I’m sure there is an app to make it easier, and I suggest you look there if policy for your org is to use apps first. And I know there are other solutions, this is just one that I find quick and easy because I don’t have to give it too much thought.

Accounts before Owner Change

First: Always try it in a sandbox first and test the results before doing it in production.

Second first, locate the user id of the person who’s object owners ship you want to change from. From their user page (or just copying the link), grab the object ID from the URL.

Find Object Owner

Copy Object ID
Copy Object ID

Now open Salesforce Workbench in another tab, login and navigate to Queries > SOQL queries. If you are adept at SOQL, create a query to pull all of the object you want to re-assign based on the user id. If you are not comfortable writing your own SOQL or just feeling lazy, use Workbench to help create the query:

Select Query in Workbench

The key values you want are the object ID and the owner ID, though adding a Name field to check the values can be helpful. Be sure to select View as Bulk CSV then run the query. Save the resulting file. I recommend naming it something that is meaningful to you rather than accepting the long string produced by default. Open in your favorite CSV editor to see the object and owner ids.

Next, get the user ID of the new owner(s) the same way you did for the current owner. In the CSV file, change the OwnerId value as desired.

For safety reasons, delete all columns from the csv file except Id and OwnerId, then save it with a different name as a CSV file.

Object and Owner IDs only

Back in Workbench, go to Data > Update. Select the object type and click the Choose File button and select the file you just created with the new OwnerId(s), then click Next.

On the mapping screen the values should already be mapped. Check that only the ID and OwnerId are mapped and click the Map Fields button. If there are many records, check the “Process records asynchronously via Bulk API” option on the resulting page then Confirm Update. Note that if rules were changed since the records were created you may have errors that will require fixing the records before they can be updated.

Could happen if rules changed since created

And in list view:

After Owner Change

Facebooktwitterredditlinkedinmail
© Scott S. Nelson

Salesforce Deployments when Other People’s Code Fails Validation

As a cloud architecture consultant I have always applauded Salesforce for requiring 75% test coverage for deployments. I just wish that it was a minimum per class rather than an average per org. Why? Because things change and over time the average in production can come down to the point where adding a new change set that is at 75% when averaged with what is in production drops the total average. Because of this, I have set the standard for my team as 95%, which always got us through this issue until recently.

Another team had run a deployment that removed methods previous tests relied on. When my change set was validated, I was surprised to see the following error:

Method does not exist or incorrect signature
Method does not exist or incorrect signature

What was most vexing about this is that none of the classes in error were touched by my change set. Usually this can be fixed with a recompile, but not this time. What to do? Well, someone else had gotten a deployment through (there are multiple teams working in the org), so I knew there had to be some solution. And there was! Sparing you the dozen things I tried that did not work, here is the solution:

Run specified tests

And the proof:

Ready for Quick Deployment
Facebooktwitterredditlinkedinmail
© Scott S. Nelson

Get Hands-on with VS Code, Salesforce DX and Packages

(Originally published at Logic 20/20 as SFDX, VSCode, and deploying from a package the editors stripped out all of the links, rendering it an entirely different post. This is the original version.)

While I do not immediately dislike new tools, I do struggle with adopting them when I find nothing wrong with the old ones. And then I delay learning them until I’m forced to, which is the case of Visual Studio code for Salesforce (they are no longer supporting the Eclipse IDE and abandoned the DX extension for Eclipse before DX went GA) and Git (because that is the way the dev world has gone). I find the best way to learn new tools is to write about how to learn them, so here we go.

(In the spirit of working in a low code platform, we will also see how much of this I can do with just links to existing documentation…)

If you haven’t already, Install Salesforce Extensions for VS Code.

Then Enable Dev Hub in Your Org and Enable Second-Generation Packaging (note that while 2GP is beta as of this writing, this is required to enable first generation Unlocked Packages which is GA).

Next…Well, that didn’t take long. I cannot find a stand-alone URL for creating an SFDX project, so I’m going to steal a section from a Trailhead lesson (because it is as much typing to say what not to do as it is to re-create it here):

  1. Open VS Code.
  2. From the menu, select View | Command Palette.
  3. In the command palette search box, enter [PROJECT_NAME].
  4. Select SFDX: Create Project.
  5. Use the same name as your GitHub repo, then click Enter.
  6. Click Create Project.
  7. Create a .gitignore file to ignore hidden directories:
    1. Hover over the title bar for the DX project. then click the New File icon.
    2. Enter .gitignore. [check if it already exists and just edit if so]
    3. In the text editor, indicate to ignore these two hidden files:
.sfdx
.vscode

To foster good habits, I will set up a github repo to store this project in (though following a full lifecycle will be another article) by following the excellent documentation at https://help.github.com/en/github/importing-your-projects-to-github/adding-an-existing-project-to-github-using-the-command-line and add the project to the repository.

Now go do some work in Salesforce. For example purposes, let’s do the Build a Simple Flow project.

After you complete the project, follow the instructions to Create and Upload an Unmanaged Package, skipping the Upload part. I named the project TH_Flow_Project, which you don’t have to, I only mention that as I will use that text in the example commands.

Salesforce provides a nice reference to Create a Salesforce DX Project from Existing Source.  I have some additional thinking around how to go about this part, so I will end the approach of linking to references and switch to my own approach. If you followed the last link and stopped here, you won’t learn anymore about the Salesforce DX capabilities, but you may miss out on some of my shortcuts and wit. With that said…

Authorize the org you created the flow in with the following:

sfdx force:auth:web:login –setalias <MY_SOURCE_ALIAS> –instanceurl <MY_ SOURCE_ORG_URL>

Example:

sfdx force:auth:web:login --setalias TH-ORG02 --instanceurl https://infa-ca-wav-dev-ed.my.salesforce.com/

A bit late to mention, but if you are using a Developer org, I highly recommend to Set Up My Domain. Trailhead orgs already have one. If you haven’t, you can probably leave off the instanceurl parameter and it should pick it up from the default configuration for your project (YMMV). Otherwise use the URL that you login to your org with.

Next, download the package using the following:

sfdx force:mdapi:retrieve -r ../ -p <PACKAGE_NAME> -u <USERNAME>, ex:

sfdx force:mdapi:retrieve -r ../ -p TH_Flow_Project -u scott@trailh2.org

Let’s break that down just a bit. The first part is the base command to retrieve (sfdx force:mdapi:retrieve). The -r parameter determines where the downloaded zip file will be located. The example uses a relative path indicating the folder above the DX project. As a best practice, I recommend always staying in the project directory inside the VSC terminal, with all commands base on being relative to that location. This way you can maintain a list of commonly-used commands that will be re-usable across all projects. The downloaded file name is always unpackaged.zip.

The files need to be unzipped before they can be used (someone should make a feature request for the convert command to work on zip files instead of having to unpack them first). In Linux the relative command is:

unzip ../unpackaged.zip -d ../

Now we add the files from the package to our project using the relative path command:

sfdx force:mdapi:convert -r <PATH_TO_UNZIPPED_PACKAGE> -d <PATH_TO_[/force-app]>, ex:

sfdx force:mdapi:convert -r ../TH_Flow_Project -d force-app

Now all of the files from your package are part of your project.

To add this to your target org, first authorize that org as done previously for the source org, i.e.:

sfdx force:auth:web:login –setalias <MY_TARGET_ALIAS> –instanceurl <MY_ TARGET_ORG_URL>

Example:

sfdx force:auth:web:login --setalias TH-ORG02 --instanceurl https://infa-ca-wav-dev-ed.my.salesforce.com/

And (almost) finally, deploy the updates from your project to the target org with:

sfdx force:source:deploy -u <TARGET_USERNAME> -x <PATH-TO-PACKAGE.XML>

sfdx force:source:deploy -u apex@theitsolutionist.com -x ../TH_Flow_Project/package.xml

(Another feature recommendation is to have an alias option instead of only the username.)

And finally (this time for real!) look in your list of flows to see the flow installed in your target org.

Of course, you are doing this with a throw-away org, right? Because I forgot to mention that deploying will over-write any existing components with the same name.

One final note. We used the package.xml from the downloaded package for the sake of simplicity. Once the package import is validated, you will want to combine the package.xml from the download with the package.xml in your project located in the manifest folder of your project.

The project created from the writing of this article can be found at https://github.com/ssnsolutionist/trailhead1

Facebooktwitterredditlinkedinmail
© Scott S. Nelson

Preparing for (and passing) the Salesforce Certified Platform Developer I Exam (WI19)

(Originally published at InfoWorld, this version has an additional section on test taking tips.)

I’m ambivalent about certifications. Because I spent enough time in school for the equivalence test validation to be embedded in my psyche I have enough certificates to fill a two-inch binder clip. Because I have been working in the real world long enough to know what most of them truly reflect, I actually display them all in two-inch binder clip with a sticky-note on top that says “Pick One”. Anyone who has multiple certification knows that not all are of equal value in terms of proof of knowledge. I have one from an enterprise vendor that is a household name, very fancy looking with a hologram in the middle. It is the result of showing up for class every day for two weeks and the check clearing. Yet I learned a great deal achieving it. Another was acquired as a pre-requisite for continued employment following a merger, which was easily achieved with no study and only a third of the allotted test time. The next took a solid year of daily study and was taken in hopes of leveraging it to leave the employer that required the previous one. 

My most recent certification was one of the more difficult to study for: The Salesforce Certified Platform Developer I (WI19). While I have plenty of practical experience working with Salesforce, there are many aspects of the product that are required knowledge for certification that just haven’t come up for the businesses requirements I have been fulfilling. However, I enjoy working with the product and Salesforce has done a good job of convincing decision makers of the value of certification as an indicator of ability that I wanted to have it to please those decision makers. So here is how I went about it.

Trailhead

Trailhead is an invaluable resource for learning Salesforce, regardless if you are seeking certification or not. I use it all the time to keep up on new and updated features and whenever I run across a requirement where a tool that I’m not thoroughly familiar with may be helpful. Also, in 2018, Salesforce move the certification verification to Trailhead as well as the maintenance exams.

If you have not already created a Trailhead account, do so before reading on. If you already have a free Developer org, sign up at Salesforce Trailhead. If not, go to the Developer Edition site and get yourself one first. Pro tip: Don’t use your email address as your user ID for the Developer org, even though that is the default value on the sign-up form. User IDs must be unique to all of Salesforce, not just the org.

On Trailhead, navigate through the menus under Credentials > Certifications then to the specific certification you are interested in (or jump to the Platform Developer I (PDI) page). Here you will find the Exam Guide, which is a good way to understand the structure of the exam. There is also a link to a Trailmix. Trailmixes are groupings of Trailhead training modules and super badges created by Salesforce and other Trailhead users. These are a great way to begin preparation for a certification. If you have been working with Salesforce, many of the modules will be topics you are already familiar with. Skip those according to your own confidence level. I will add this personal anecdote about skipping Trailmix modules: The second-lowest score I received on the exam was in a category I work with regularly. The exam questions were about aspects that I no longer consciously think about, similar to how it may be hard to give directions with street names for a route you travel daily because you traverse them on autopilot. A refresher may be useful.

Udemy

I used Udemy to great success for the Salesforce Administrator’s exam by taking an excellent preparation course taught by Francis Pindar and then a practice test course with three practice tests. Preparing for the Developer’s exam was a bit more daunting, mostly because the nature of the exam has evolved in the last couple of years and the courses have not caught up with it.

Before you get sticker shock looking at the Udemy courses, here is the strategy to pay a reasonable price for Udemy courses in general. Create your account on Udemy and take one or two free courses (there are many worth doing). Eventually (at longest up to three months) you will receive and offer for all courses for a flat rate per course that is quite reasonable. If your employer has a discount program that includes Udemy (such as Fond), you can get an even better price. I only paid $9.99 per course through my company’s Fond program.

As of this writing, the best Udemy course I found for the Developer’s exam is Salesforce Platform Developer 1 Certification Course by Deepika Khanna. It seems to be an Apex developer course that was later re-purposed for certification prep. As such, most of the content is there, though it may not be clear how it translates to the exam. There are also several course files that are not referenced in the course. One of these is a practice exam that has all of the answers in Word. Most of these questions are also in Salesforce Certified Platform Developer practice Tests, so I suggest you not read the Word document until after you have gotten everything you can from the practice exams.

I had taken another prep course on Udemy that had a great outline, but I did not find it a good learning resource as evidenced by the abysmal score I achieved on the first of the two practice exams.

The practice exam on Udemy is not the greatest, though it does reflect the actual exam process well, if not the questions themselves. There are a lot of spelling and grammatical errors in the practice exams and the mistake I made was to assume that an incorrectly spelt answer was automatically wrong. The spelling issue is not seen in the actual exam, so it is just an issue with the practice exam author.

Another lesson about practice exams is to avoid the temptation to take them early. There are only so many questions and you can end up memorizing the answer to those rather than learning the topic well enough to answer similar-but-different questions on the actual exam.

Other practice exam sites

The site I got the most from for drilling on test questions is a ProProfs Quiz, appropriately titled  Salesforce Platform Developer 1. Questions are added and updated occasionally. There were 131 questions available the final week before I took the exam. The same spelling issues seen on the Udemy practice tests are there, and many of the same questions. I also noted questions from the course quizzes from the exam preparation course I took, though not sure who copied who there. One thing to be aware of is that not all of the questions have the correct answers. Believe it or not, that is a good thing if you use the strategy I did. Every time I took the exam, I would research the questions I missed to better understand the concepts. This helped a lot. I also would save the final page with the answers to a PDF that I stored on my phone and reviewed when idle.

Some other useful practice sites:

  • Salesforce Certification Dev 401 #1 (also on ProProfs Quiz) is for the older exam. Most of the questions are still relevant, as the new exam has more topics than the old one.
  • Salesforce Certified Platform Developer 1 Quiz at Salesforce Tips, Tricks, & Notes is short but some of the questions are really hard. The order of events question was especially helpful in getting this topic down.
  • Simplilearn’s Free Salesforce Platform Developer I Practice Test is very hard, probably because they sell a certification preparation course. It requires some contact info, but I found they only send you ads a couple of times. No telling if they sell the info, though. Which is why I keep an anonymous account for such registrations.

Key topics to study

  • There are many questions related to Triggers and Order of Execution. Memorize this as best you can.
  • Knowing the Data Model well will boost your score. If you are good at memorizing things, the link will be sufficient. Otherwise, hands on experience (at work or on Trailhead) is the best way to embed the key points into your subconscious. I studied this the least and it was my highest scoring area from a combination of project work and Trailhead modules. YMMV.
  • Apex Testing has a multitude of sub-topics and there are some over-lapping concepts that can be confusing if you don’t regularly use this aspect of Salesforce.

Test Taking Tips

(This is a bonus section for readers of my LinkedIn or Solutionist blogs)

The process of answering the test questions is just as important as the approach to preparation in ensuring a passing score. I first go through the test quickly, reading each question and response options and answering those that are immediately obvious to me. I then go through a second time, answering the questions skipped the first time through and marking for review any that I don’t feel 100% confident about. An advantage to this approach is that sometimes one question is worded in such a way that I easily remember the answer and it reminds me of the correct answer to another, related question.

I then go back and review all of the questions marked for review, re-read the question and answer and asses my confidence. I do this in order of the exam questions because I still might leave it marked for review on this pass. The ones I was still unsure of on the review I then re-review. Finally, I go through the test from start to finish, reviewing each answer.

While this may sound very time consuming, I usually still finish with 20 – 30 minutes to spare.

Some final comments about certifications

The Salesforce employment market is heavily slanted towards certified applicants, so if you really like working with Salesforce and aren’t already in your dream job (or are a consultant who is always pursuing new clients), Salesforce certification is a must have. The Salesforce Administrator certificate I find the easiest to achieve, and if you are serious about Salesforce development I recommend getting both certificates because knowing enough administration to be certified will help you in designing better components.

No matter how hard or how easy a certification is to obtain, almost all are proof only of knowledge. In general, the application of knowledge is where the value is. As someone pursuing certification, continue your learning after certification. I find participating on the support discussions and completing Trailhead modules regularly to be a good way to grow beyond the day-to-day tasks.

And for employers, please weigh overall experience with certification achievements. Someone that has years of technical experience on multiple platforms and coding languages will be able to become very proficient in Salesforce in a short period of time, and someone with several certifications who has little experience outside of Salesforce and all within a small variety of orgs may not be the right fit for a complex implementation.

Finally, my own score on the exam was not in proportion to my actual capabilities. The exam results are broken down by category. In one case I scored very low in an area that I use regularly and frequently advise others on. In another case I scored quite high in an area I rarely use and most of my learning was academic. Having previously passed the administrator’s exam, it is no surprise that my best categories were the areas that overlap.

Facebooktwitterredditlinkedinmail
© Scott S. Nelson