function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jon2010Jon2010 

Build URL to display a case using case number instead of Salesforce unique identifier

What I'm looking for is a way to build a URL that will link straight to a specific case number, without knowing the unique identifier for the record.

 

Let's say I have a case which I've numbered 245968, and I want to go straight to it.

 

If I knew the UID I could use a link like this, which actually works:

https://emea.salesforce.com/10010000001cGK4

 

That's no good to me for this particular application, because I don't know the UID yet.

 

Is anything like this below, but that actually works? (this is just a non-working example to show what I'm looking for).

https://emea.salesforce.com/CASE_NUMBER/245968

 

The closest I have found so far is this

https://emea.salesforce.com/search/SearchResults?searchType=2&str=245968&asPhrase=1&sen=500

 

That works, but it brings up search results and requires an extra click to get to the actual case record. I want to go straight to the record without an additional click.

 

Surely this must be possible..? Many thanks for your help!

mpietrasmpietras

you ever get this figured out?  i need it as well... thanks...

Jon2010Jon2010

Sadly not, but it's intersting to note that 460 other people are presumably also looking for the same thing...

 

I've given up for now, but if you manage to figure it out, please share it here.

bleurosebleurose

Strange that two years later and after MANY people need this very simple and almost trivial capability, they still don't provide it "out of the box".  It is so obvious that it defies any rational explanation or reason for not doing it.  It can be done yourself using the Salesforce API to fetch a case by case number (using the query API instead of the search API) and then extracting the 18-character unique id and building the URL yourself.  But this is amazingly crazy that you have to go to all the trouble to build this yourself when would be about 1 day's worth of work for Salesforce to put this together and make it available to their entire community.  Unbelievable!

Jordan CookJordan Cook
I have created a workaround for this mising feature as I realized I had a need for it as well. This will require you to create two components:
  1. Apex Class
  2. VisualForce Page
 
public class getCaseByNumber {
    public static String getCaseQuery () {
        string caseNumber = ApexPages.CurrentPage().getParameters().get('CaseNumber');
        if(CaseNumber == '' || CaseNumber == null) return 'You Must Supply a Case Number';
        List <Case> c = [SELECT Id FROM Case Where CaseNumber =: caseNumber];
        if (c.size()>0) {
            return string.valueOf(c[0].Id);
        }
        else return 'Case Not Found';
    }    
}
<apex:page controller="getCaseByNumber" title="Get Case By Number" showHeader="false">
  <script>
      if ("{!CaseQuery}".length > 0) {
          if ("{!CaseQuery}" != "Case Not Found" && "{!CaseQuery}" != "You Must Supply a Case Number") window.location = "/{!CaseQuery}";
      }
  </script>
  <h1 style="display:block;margin:25px;font-size:16px;">{!CaseQuery}</h1>
</apex:page>

Then you can link to cases using a URL like this:
  • https://[instanceName]/apex/viewCase?CaseNumber=XXXXXXXX
  • https://na16.salesforce.com/apex/viewCase?CaseNumber=00001000
It may not be pretty, but it works.
Prabhu Venkata KrishnanPrabhu Venkata Krishnan
Hi from 2017, looks like we are in search of this functionality since 2009. Do we have any solutions yet? 
ethan hammondethan hammond
Bump, 2019.... Has this been answered?
Roland KuswandiRoland Kuswandi
2021 said Hi to this unsolved case. Come on, Dev!
Stacie Wall 22Stacie Wall 22
Bump 2022
Dani KoretskyDani Koretsky
Another bump, are we really expected to never be able to build a link to a case from it's case ID?
Mikkel SierckeMikkel Siercke
2023 also says hi! Amazing that this is still not possible 13 years after this issue was posted.
coalition strengthencoalition strengthen
It would seem that we have been seeking this capability since 2009. Do we have any ideas about how to proceed?  dordle (https://dordle.io)