If I log into my Developer Account at Salesforce and open the
Developer Console, then I can click “New” and create a custom
Apex Class. I might give it name such as:
If I go back a few days later, and log in, I can click “Open” to re-open this class. And now I see that it’s full name is:
That ending, apxc, is added automatically by Salesforce.
But if I go to https://force-cli.heroku.com/ and download that for my Mac, and then run:
I get a huge number of files, and if I look in the “classes” folders, I see some of the custom Apex classes that I created, but now they have a
clsextension, for instance:
Why is this? Why would the same code have different endings in different places? Does Salesforce respect both
clsas legitimate extensions for the code that I write?
I suspect the apxc extension for Apex classes and apxt for triggers is specific to the Developer Console.
.trigger are the extensions that the Metadata API expects.
The file suffix is
.clsfor the class file. The accompanying metadata file is named ClassName-meta.xml. Source
The file suffix is
.triggerfor the trigger file. The accompanying metadata file is named TriggerName-meta.xml. Source
The Developer Console uses the Tooling API to get and update the body of the of apex classes, triggers, etc… As such, it is missing the extensions that the Metadata API exposes.
My guess is that the developer console needs to add extensions for the editor that it uses. If you search in the source of ApexIDECore.js there are references to the extensions:
Either it doesn’t support longer extensions like
.trigger so they needed to come up with a shortened scheme or they just ignored the existing extension scheme and came up with a new one.
If you are putting things in source control, stick with the extensions that the Metadata API expects and ignore the developer console.