Tuesday, January 12, 2016

Geo location fields throwing "No such column 'XXX__c' on entity 'XXXX__c' during deployment.


While performing a routine deployment to Salesforce we encountered a really weird issue:

We double checked if we have missed any permissions or something else but no, everything was ok.

In order to keep this story short, we found our smoking gun:


If we comment that line, at least the SOQL, the issue automagically gets fixed. What???

After more research and dozens of interactions with Salesforce support we found that this is a known issue with the plattform:

Salesforce has a workaround for this, but it will require to have Salesforce helping us to deploy this line after a regular release every time.
In other words:

  1. We deploy all our changes
  2. Ask Salesforce to deploy that code

Then in a subsequent release:

  1. We comment that line and deploy (reference to geolocation is gone)
  2. Deploy any additional code - BAU
  3. Uncomment line on lower environment
  4. Ask Salesforce to deploy that code referencing geolocation
  5. And repeat this forever until Salesforce fixes that issue

OR

Convert that query into a String:



By doing this we tricked the Compiler, so the validation that breaks the whole deployment never is executed, therefore our code is just executed/compiled during runtime.

Voila!!!

Thursday, January 7, 2016

New Baby

I know, this is not technical stuff, but I'm really happy and excited about it.



Soon (between this week and the next one) I will become a Dad for the second time!!!