Friday, January 16, 2015

Enable Visualforce pages for Salesforce1

It's a fairly simple process.  Barring any unsupported stuff on the VF, it should just work.  However I've run in a timeout issue on more than one occasions - clicking on Save ended with a timeout page and the change was never saved.  Had no idea why and didn't have the patience to open a case with Salesforce, so I took the developer route.

Here's how you can work around it if you can use developer tools (or any Metadata API enabled tool for that matter).  The enablement switch is implemented as this availableInTouch field on the ApexPage object.  All is needed is to flip it to true.  For instance if you have Eclipse, you'll notice the field as a member in the page-meta.xml file.

 <?xml version="1.0" encoding="UTF-8"?>  
 <ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">  
   <apiVersion>27.0</apiVersion>  
   <availableInTouch>false</availableInTouch>  
   <confirmationTokenRequired>false</confirmationTokenRequired>  
   <label>MyPage</label>  
 </ApexPage>  

Quick code formatting provided by Source Code Formatter

Once flipped, save it (remember to Save to Server, as Eclipse doesn't build it to server for meta files) and you're all set.  Similarly this can be done with Ant as well.

Please note the field is only available API 27 or later, so make sure the tool connects using supported API versions.

Thursday, October 30, 2014

Can't be portable with MavensMate

I wanted to try MavensMate.  Force.com IDE is like this comfort food you can't live without, but you started to wonder whether there's a better dish to keep you healthy.

So after thinking about it for quite some time, I finally got around to actually do it today.  I don't have a Mac, but MM should work for Windows too.  I downloaded Sublime Text and MavensMate, followed the instructions (solved some little issues along the way), and ... it didn't work.  "New Project" from the menu did absolutely nothing.  So I opened the console in Sublime and noticed the error message about needing mm_workspace information.  Eventually I found the issue - basically the portable version of Sublime Text does NOT work for MavensMate on Windows, because MM would be at a loss when it needs to find the settings file.  I couldn't figure out where the connection.py file is to modify as suggested on the Github issue page (maybe because I'm using the x64 version of ST3) so I just reinstalled Sublime with the regular Windows installer, and things started to work.

Overall the first step for adopting MavensMate was a bit more involved than I expected. It's a young tool - I told myself.

Tuesday, August 5, 2014

Skeleton code for Batchable/Schedulable classes

I wish Force.com IDE had a quick option to generate a skeleton class for Batchable classes.  It has one for test classes, so why not this one?  For now I just paste in my own skeleton code to save typing the same stuff every time.
global class BatchableSample implements Database.Batchable, Schedulable { global Database.Querylocator start(Database.BatchableContext context) { // TO-DO: construct the actual query return Database.getQuerylocator([Select Id From Account Where CreatedDate = TODAY]); } global void execute(Database.BatchableContext context, List scope) { } global void finish(Database.BatchableContext context) { }

// schedulable global void execute(SchedulableContext context) { } }

Friday, August 1, 2014

Salesforce connected apps settings are not copied to sandbox

So for me this was learned first in practice, then confirmed by Salesforce knowledge base article 194090.  When a sandbox is created/refreshed, custom connected apps configured in production will be not be copied, even though they're part of the configuration/metadata.  This is true for full sandboxes as well.  The standard connected apps (Salesforce1, Chatter Desktop, etc.) will obviously still be there.

The KB article also pointed out that you can't reuse the same API name when you recreate the apps.  It's probably the result of this known issue.

These oddities combined with the still confusing UX with connected apps - create in one place (Create > Apps) and edit in another (Manage Apps > Connected Apps) made Connected Apps still feel like a beta feature.

Sunday, July 27, 2014

Ubuntu 10.04 static DNS server

Had to do a reverse drop-in replacement for a Ubuntu computer - reverse in the sense that I'm not dropping in any part - instead I got an identically configured computer and just dropped in the hard drive.  Pretty much everything just worked, except the network settings.  Ubuntu by default added a new interface (I'm using wired connection) since it saw a new MAC.  So I had to apply the static config from the old interface to the new one.  Again most of it just worked, but DNS didn't - I added the server address to the IPv4 config via Network Manager (editing resolve.conf actually gave the same result), but it still couldn't resolve names.  I tried networkng restart, which also did nothing.  So I just used the Network-manager applet to disconnect then reconnect, and DNS started working.  I wonder if there's a command line way to apply static DNS info?

Monday, July 21, 2014

Box Sync client update moves sync location (without really telling you)

So this is Box Sync v4.0.5101 for Windows.  Once the update was installed (acted just like previous updates), it started the location change right away pretty much silently.  The first sign of it was I no longer had the "My Box Files" symlink (under Favorites in your Explorer window).  It had a vague message on the app window but who really checks that?  Once it's "done", it also popped up a message saying so.  Again, without context you don't quite grasp what that means.  The worst part is that the move was incomplete, probably because I had various things opened in applications.  So I ended up having a bunch of folders that exist at both the old location (users/username/Documents/My Box Files) and the new location (users/username/Box Sync), and I had to manually move things over.

It's bad enough we can't choose the sync folder location - what if you want to store things out of the system partition?  Now what's the point of moving the folder up one level?  If anyone is like me, who uses Box extensively for protecting and sharing all kinds of files, you have a lot dependencies on the location: apps need to know where its stuff are, binaries need to have its path set, etc.  With the relocation plenty of headache to reset everything, let alone the hassle of reestablishing the habit of saving new things to the new location.

Box is overall a good product for cloud based storage/backup, but this sync folder location issue is definitely a drag on usability.  This recent change of location just made it even worse.

Monday, June 30, 2014

Getting Started with Node.js on Heroku ...

... is not easy on Windows.  This Guide is a good one.  The steps are clear with right amount of details.  I just couldn't get through it on Windows 7.  First I couldn't verify my app with foreman.  I got "Bad file descriptor".  After tinkering with Foreman versions a bit to no avail, I decided to go ahead deploy it, thinking maybe it's just foreman.  That didn't go either.  I just kept getting "Permission denied (publickey)" with git push, even after checking and rechecking I have the keys and they're added to Heroku (key addition notification from it as proof).

So I did anyone reasonable would do under such circumstances.  I switched to Linux.  I was able to have the app running on a dyno within 20 minutes on a Precise (12.04.4), including the time needed to set up a build environment and make the Heroku client - it's a VM I don't usually use to build stuff.  What can I say?  Next year I'm building a Ubuntu laptop (or getting a Mac).

UPDATE: I had a chance to ask Jay Hurst from Salesforce about the troubles on Windows.  He mentioned that the problem with foreman may be related to the fact that the utility is looking for a particular kind of shell.  He suggested trying the bash installed by Git on Windows.  For the key troubles?  "You could have key problems on any platform. "  :-)