I haven't covered installing all the tools on this article. I do remember it was a bit of a pain to get it all working well. If I ever have to install them again, I will update this article.
As the following article suggests - use Sublime Text Package Control to install it. http://mavensmate.com/Plugins/Sublime_Text/Installation.
Creating the Project
Open ST. Use the MM menu to create New Project. For the new MavensMate App the App has to be open first before you can use the Project menu. It is really kind of annoying. I did like the old way it worked.
(note: I do have a licence for ST, I just haven't registered it on this machine yet).
There are a lot of keyboard shortcut commands for Sublime Text, but as we are probably more familiar with menus and clicks (clicks, not code), I will show all the menu based commands, but see http://mavensmate.com/Plugins/Sublime_Text/Shortcuts for shortcuts.
Enter the Name of the Project, your User Name and the Password+Token - chose Production or Sandbox. Go to the Advanced Tab.
The location will default to the location you set up in your settings file (mm_workspace http://mavensmate.com/Plugins/Plugin_Settings).
After you click the Advanced Tab or click Create Project, MM will log you into SF.
After you click Create Project, it will take a bit of time to download all the metadata and create the project in ST.
Note: the screenshots here show Update Project for an existing project - the options are the same for a new project - you just have a Create Project button.
This is where you choose what metadata to sync. It is easy to just choose everything, but it will dramatically slow your syncing down.
In this list, you can't select ALL options at once - you have to click 51 times - probably to make you avoid clicking every single one of them.
The default is 7 items selected, but you can change the settings file with mm_default_subscription. See SubscriptionSettings.txt for a list of the (current) 51 items.
This screen is a little tricky - click on the drop down list again to hide the list of options and reveal the rest of the form.
Remember to click Update Subscription when you are done - not to be confused with Update Project.
If the Refresh Index button is displayed, click that also (and wait). You will hear the nice MM "ding" when it's done.
On this list you can chose all at once.
Check the unlabeled grey checkbox
Click Update Project when finished. The "ding" will sound when it's done.
Objects, Page Layouts etc from Managed Packages (Apps from the App Exchange or maybe from a Developer you are working with), will NOT be in this list. You have to manually add the names to the package.xml file. See http://salesforce.stackexchange.com/questions/13852/how-to-retrieve-layouts-of-customs-objects-belonging-to-a-managed-package for more info.
<!-- Excluded for brevity -->
<!-- Added the Payment Txn Object from the AAkonsult Payments App -->
When the Project is Setup
What do you get
The config folder
Hopefully you won't need to delve into here too much if you are not a developer.
The src folder
The src folder contains all the Salesforce configurations "source" - the metadata (or structure) of your whole Salesforce org
The files are in generally XML format, except for the code files (triggers, classes).
If you ever need to understand anything about the metadata, check the Developer Reference http://www.salesforce.com/us/developer/docs/api_meta/index_Left.htm#StartTopic=Content/meta_types_list.htm
Each Standard and Custom Object in your Org is has a file. It may look a bit daunting but use your search (ctrl+f) to find a field name that you know, and then work back from there.
See Object Metadata
Each Layout has it's own file.
When you have a number of Rules for Page Layouts the only real way to keep them up to date easily is through the metadata API.
See Layout Metadata
Quickly modify or duplicate reports with different parameters
Quickly modify some text - especially if multiple emails are affected.
Search the permission in each Profile
You can't duplicate Actions via Setup - you can here!
Using your fields exported from the List Fields for Object command, modify the text to quickly add all the new fields to the Report Type
Quickly duplicate workflows with different conditions.
Find where a field is used in the workflow.
Backup the Project to the Cloud
Create the repository
- Click the Add a Repository button (the first one).
- Click Create Repository
- Select the folder you saved your MM files in.
- Give it a name
- Click Create
Open your Repository
- Select all the files in the working tree (click on one then do ctrl+a/cmd+a)
- Drag the files to the staging index
Add a remote repository in BitBucket
- Right Click on REMOTES
- Click New Remote...
- Connect to your Bitbucket
- Enter a Name
- UNCHECK Publicly Visible.
- Choose Git as the type.
- Click Create Repository
- Choose that new Repository in the list of Repositories available.
- Click OK
- Give the remote a name. Click OK
- Enter a Commit Message - just a note to yourself to say why you are saving your Salesforce Configuration at this stage. I normally do this before I do major changes to the configuration.
- Check Push commits immediately to (and select your Remote).
- Click Commit
It's done - your Salesforce Metadata is now backed up to the cloud.
Triggers and Classes
If you are in Sandbox you can modify Triggers and Classes. If you are in Production, you can look at the code, and you can set triggers to be inactive, but you can't modify it.
One good thing about looking at code through ST is the colours!
Code comes in pretty colours (yes, it is blurred out).
Use the List Fields for Object command to list the fields in a selected object - helpful for pasting into any documentation you may be doing.
It's a simple list, and I think that Grey Tab provides a better way of accessing this information, but it might be helpful.
Use regular Search (Cmd+F/Ctrl+F) or Search in Folder (right click on src and chose Search in Folder)
What to search for
- Field Name
- Field Help Text
- A specific formula (eg "*1.1" to find GST to change it when the horrible Liberal government ups the rate - not that your GST rates are hard coded - are they?!?!).
Refresh the Org in ST
- Open the MM Project in ST
- Right click on src, chose MavensMate, then Refresh from Server...
- The updates will show in the bottom of the ST window.
- Remember to then check in your latest updates to BB to save them.
Using Excel to create the XML Structure for new fields https://success.salesforce.com/answers?id=90630000000gtheAAA
Here is the template that I use https://docs.google.com/spreadsheet/ccc?key=0Ar3Bg2QuV-_IdEtzSXBrWTZiNUZxRlRoV0tYM3RoZ2c&usp=sharing thanks to Ezra Kenigsberg - Make sure you read the notes and save this as a copy for yourself. I have modified the file to include Help Text and basic security - feel free to build on anything that I have done and let me know so that we can share it here https://docs.google.com/spreadsheet/ccc?key=0ArmEWnxyp7DvdDFpX0c2LWh4UDBlUzZtZW9wOUVUcUE&usp=sharing.
- Update the Help Text
- Create new Picklist Values (although it is probably easier to do this via the UI).
Issues and Gotchas
- it uses Token Authentication, which is a real pain when your passwords change and you have to enter the username, password and token again. (Dataloader.io is fabulous for using OAuth now, and it's the way all dev tools should work).
- Name your projects really really well. (Well that might not be an issue if you just have Live and Sandbox, but for me who has multiple projects, it gets annoying if I'm not careful).
- Go to Config>.settings to see the details of the project if you get a bit lost.
- Everything takes a little time, so be patient with it.
- You are going to get stuck on the settings of what items have been synced - if you can't see everything, then go back and check those.
- Both Sublime Text and MavensMate are updated so regularly that if you are not using them every day, you probably have to install an update before you can use them. So just give yourself some time.
- You have to go through a specific routine to update the plugin.
- Close ST
- Download MM
- Run MM
- In MM Menu chose to update the ST plugin.
- Run ST
This approach uses the Metadata API or the Tooling API, so it might be handy to get to know the Salesforce API's. See Salesforce API. Also try to understand more about Salesforce's Metadata in general.
Further things to look into
If you are a dev and are reading this
You may want to take things way further...