Thursday, June 27, 2013

Using new operators for Id field in SOQL (Summer '13 feature)

Starting with the Summer '13 release you'll be able to in SOQL use additional comparison operators on the Id field, such as <, >, and >=.  Once I was at an intro session to the new release, and an audience member asked, "Why do we need those?"  Good question.  I actually had no answer for it.  Indeed ordering by Id seems to be an awkward way to locate things.

Today I found a good use for it.  My task was to get all customized profile names and stick them in my package.xml along with a whole bunch of stuff to deliver their permissions at the same time.  I was surprised to see there's no indicator field on the Profile object to tell me which ones are custom.  So my solution was to use Id since all the standard profiles start with '00e70000000', and custom ones start with '00e70000001'.  Do a simple id > in the WHERE clause, and I'm all set.

Not a significant use, I know.  Hey beats nothing, doesn't it?

Footnote: why did I need to do only custom profiles?  Because for some reason, the metadata API (via ANT) doesn't want to take standard profile names (neither retrieve nor deploy).

Tuesday, June 25, 2013

Metadata safety

Salesforce makes it too easy to change configuration sometimes.  I'm sure I'm not the only one who says that.  The ease of changing things is the beauty of it, but as with any good things, it can also be a curse.  So to have an effective process for managing configuration means to have a balance between that agility and the stability of configuration (metadata).  I added a comment today to this idea, which hasn't garnered much love, partly because it's vague.  

I think the idea has a very valid point: there isn't a consistent way for administrators to operate in a safe way, either with or without developer-level support.  There should be a safeguarded environment for administrators to undo and manage metadata revisions (configuration changes), either through UI or via an automated backup process (for instance, by using sandboxes) supported by metadata API scripts.

Wednesday, June 19, 2013

Setting up Galaxy S3 with Hotmail

You'd think that's an easy task in 2013.  The truth: not so much.  The native Android mail app did add it easily (using POP3 I assume) but the app never received a single new message since setup.  I tried adjust every setting that seems relevant and nothing made any difference.  So it's time to crowd source online.  It didn't take long for me to find this post by John Law.  That seems to make sense, but my dear wife doesn't want to sync contacts from Hotmail.  I thought since it's about the underlying sync protocol - using ActiveSync - so why not just set up the email account with that option.  So I did.  On the email setup screen select Other (I think Corporate works too), enter account credentials, then click "Manual Setup".  From the choices select "Microsoft ActiveSync".  Information then actually gets filled in automatically for you: server is m.hotmail.com as mentioned by John Law, and username is an awkward \her_name@hotmail.com, which I left alone, since I have no clue on what the domain can be.  After that just follow along with the Next buttons, and everything started working once it's done!

A side note is that the Hotmail account was not long ago migrated to outlook.com (as required).  Maybe that change resulted in some underlying shift, which broke the old scheme.

Wednesday, June 12, 2013

httpd can't be started by XAMPP



There's nothing in the logs - apparently the process didn't even have a chance to truly start.  Looked at Services and saw no one would be hogging the HTTP ports (except Jitterbit, which I already shut down).  So what's going on?  Dropped to cmd, and here's what httpd.exe said:


Well, someone is hogging the port after all.  Time to whip out TCPView (can't believe I'm doing this) and... guess who?  Skype!  Apparently it sneaks in to enable firewall evasion for peer connections (details here) if possible.  Disabled that and things started to work.

Tuesday, June 11, 2013

The User Profile Service failed the logon

One of the ridiculous error message from Windows Vista.  I had  to deal with it a number years ago when Vista was still relatively new.  Just had it again a couple days ago on an old laptop server.  It happened after receiving a warning about unable to load profile so a temporary one had been used - once logged out, the error started appearing and no login was possible.

The official methods to deal with the error is here.  Indeed the first method worked for me this time.  However if you look closely, the error is really just a result of Windows mistakenly keeping a temporary profile as the working profile (the path is "Users\temp"), so a manual fix is needed, which is basically restore the .bak profile in registry (and rename the temp one .bak) - but why couldn't the system do it automatically???

No wonder it's said that virtually the whole Vista team was fired.

Monday, June 10, 2013

The order of execution for things

This is always an interesting topic for any Force.com developer.  The official line is here, which is already a lot to digest.  On top of that, there are additional scenarios that can complicate things.  For instance, what happens when a lead is converted?  Up to 4 objects can be involved and multiple triggering moments are there.  I haven't seen an official document on that, but here's a helpful thread.  

Now I also have something to add about what workflows, which I just realized recently.   My scenario is like this:
  • I need to do the email in the workflow so I won't hit on the 1000 email Mass sending quota
  • I can't run the workflow off lead, as we're way over the quota for active rules
So I came up with a Contact workflow rule, for insert only.  That turned out, to do me no good, because it never fired.  All I saw in the log was
15:17:53.110 (5110976000)|WF_CRITERIA_BEGIN|.........ON_CREATE_ONLY  15:17:53.110 (5110982000)|WF_RULE_NOT_EVALUATED
From what I can tell, it looks like once the workflow rules get their chance, it's after all triggers are run.  By then the Contact had already gone through a round of updating, which made it no longer considered "On create".  When I changed the workflow rule to onCreateOrTriggeringUpdate, and things started to work.