We encounter problems all the time: erroneous data, unexpected outputs, but are there techniques and even concepts that will help Salesforce Administrators (and even Developers) answer question after question?
I think so and to help illustrate these, I am going to work through a real-life query I found on the Trailblazer Community, that benefited my knowledge and skills just as much as the person asking the original question. It also goes to the core of what being an Admin is all about on a typical day: being asked seemingly benign questions about how Salesforce works.
STARTER TIP! If you’ve got a Salesforce login, then you’re a member of the Trailblazer community too; this is where we can all help each other. It’s also the place where you can ask the questions that are stumping you!
The question was: How can I create a report on a custom object to see the names of files attached to records?
Step 1: Work through the question
Easy, you cry! So off I went to Reports and typed in Files…
Maybe I was being too specific. Let’s try that again… this time I went for “File” without the “s”…
Phew! That’s a bit better.
Tip 1: Generalise your query. Don’t be too specific, this may help you see more information which will answer your question.
Step 2: Check you have answered the question
I’m an ex-IT professional and sometimes it shows! Far too often I have given an answer without double checking. Or said “That’s done” without proving something is working.
So I ran the report, and it came up with the following:
Uh-oh. That doesn’t look right. There’s something missing.
Tip 2: Test! We’re not right every time. No one is perfect, so checking helps.
Step 3: Google!
I should add at this point that I had tried to look on Google, but a search on “Salesforce” and “Files” is a bit too generalised.
So I went off to Data Loader and started exporting random objects. They weren’t truly random, the Googling had shown me that Content Something might be the right file/object.
Tip 3: Don’t reinvent the wheel. There are always more projects to do, more potential to unlock. If someone has already done the work for you and this is available, borrow it, so you can focus on the next item on your “to do” list.
Ok, actually those are the top three steps you’ll need to do all the time, but they don’t always solve the problem, so let’s delve into more detail on what else you can do to solve your problem.
Step 4: Create Dummy Data
This is still technically part of the “Test” phase. Most things are. But basically, if you have a theory, try it out in practice.
If this were the right object, then I should be seeing some file data (especially if I remembered to change the default filter from just seeing “my” data!).
Next, I tried to upload a file onto Contacts and then realised that I didn’t even have a File related list attached to Contacts in my dev org. I corrected this, uploaded an example File and reran the report.
The report was still empty.
That’s fine. It proves the value of testing. My original hypothesis about what the report was doing was wrong – it’s a shame that I had already told the user to check that report, but hey, this is real life, and the user came back to me and told me I had given them an incorrect answer. Oops. Let’s try to do better.
Oh, and I put aside a mental note to investigate what the heck that report was doing because that would be fun to know too, but that’s for another day!
Tip 4: Use a dev org/sandbox if you can. It can speed up testing, and spotting erroneous data; it also prevents misleading data in a report or embarrassing workflows!
Step 5: Use Data Loader and IDs to speed things up
I wasn’t doing too well – certainly not finding the right files. Then inspiration struck!
I used Data Export to export all the records from my Salesforce instance (making sure I ticked the “Content” box. As I had been used my developer account as it was so much easier to create test scenarios, without lots of unwieldy processes to trip me up – there was an additional benefit as the data export and the volume of information to search through was very low.
I then extracted the Zip file that produced and used the Windows search function to just search for the record ID of my file (highlighted in purple, below).
So, back to that search. What did it actually look like?
The search brought up 4 files with that ID. One was the file itself, one was the Zip containing all the data, but there were two other files (ContentVersion.csv and EntityHistory.csv)
In fact, I had already looked at ContentVersion in my previous attempts, but since it came up again, it was time for a revisit.
This time, on the same line as that File ID (column B in the screenshot below), there was also the ID of the Contact, to which the File had been uploaded!
Tip 5: If it’s stored on Salesforce you can find it somewhere.
Step 6: Compare and Contrast
Ok, this didn’t match my earlier findings (where that line hadn’t shown up at all). Was I going mad?
This brings to me my favourite tip because it can be applied to many problem-based situations (and happens to conflict with Step 1, but you need a broad mind when troubleshooting!).
So, after further digging, It turns out that using Data Loader with a System Administrator profile is not the same as a Data Export. That crucial Row 3 in the screenshot above doesn’t show up when I run Data Loader, as an Admin user, on the ContentVersion object, only when I run Data Export!
I was fortunate in that I had found out my answer. However, failing all else…
Step 7: Crowdsource
To be frank, even discussing the question out loud helps as it makes your brain reconsider the topic from different perspectives. If that fails, ask on the Salesforce Trailblazer Community. There are local groups, vertical-related groups, as well as many feature-specific groups. The beauty is that these questions get preserved for posterity so that others may also benefit from your enquiries and the answers obtained. I know I have!
Fact: 99% of all questions get answered!
Tip 7: Two heads are usually better than one.
I don’t think this is the end of the story; there are other methodologies out there, but troubleshooting is a skill and hopefully, this will help you on your way. If you have more tips to add, please use the Comments box below, or join in with the fun on the Trailblazer community.
p.s. When I was writing this article, I spotted some further anomalies regarding Salesforce Files. The above solution only works if the Files were uploaded in Lightning, not in Classic! If you’ve enjoyed reading this article, how about voting for my related Idea, as a way of flagging to Salesforce that we want this feature improved?