Oh my god. It's full of code!

Salesforce development is broken (and so am I)

Before I begin this is mostly a humor and venting post. Don’t take it too seriously.

So I’m doing development on a package that needs to work for both person accounts and regular accounts. Scratch orgs didn’t exist when this project was started so we originally had a developer org, then a packaging org which contained the namespace for the package (this ended up being a terrible idea because all kinds of weird bugs start to show up when you do your dev without a namespace and then try to add one. Any dynamic code pretty much breaks and you have to remove the namespace from any data returned by apex controllers that provide data to field inputs in lightning, field set names, object names, etc all get messed up.

Still after adding some work arounds we got that working. However since the developer org doesn’t have person accounts we need another org that does to add in the extra bits of logic where needed. We wanted to keep the original dev org without person accounts as it’s sort of an auxiliary feature and didn’t want it causing any problems with the core package.

Development of the core package goes on for about a year. Now it’s time to tackle adding the extra logic for person accounts which in themselves are awful. I don’t know who thought it was a good idea to basically have two different schemas with the second being a half broken poorly defined bastardization of the original good version. Seriously they are sometimes account like, sometimes contact like, the account has the contact fields but a separate contact object kind of exists but you cannot get to it without directly entering the Id in the URL. The whole thing barely makes any sense. Interacting with them from apex is an absolute nightmare. In this case account and contact data are integrated with a separate system, which also has concepts of accounts and contacts. So normally we create an account, then tie contacts to it. In the case of person accounts we have to create some kind of weird hybrid of the data, creating both an account and contact from one object, but not all the data is directly on the account. For example we need to get the mailing address off the contact portion and a few other custom fields that the package adds. So we have to like smash the two objects together and send it. It’s just bizarre. Anyway at this point scratch orgs exist but we cannot create one from our developer org for some reason, the dev hub options just doesn’t exist. The help page says dev hub/scratch orgs are available in developer orgs, but apparently not in this specific one for no discernible reason.

We cannot enable them in our packaging org either as you cannot enable dev hub from an org with namespaces. So my coworker instead enables dev hub from his own personal dev org and creates me a scratch org into which I install the unmanaged version of the package to easily get all the code and such. Then I just manually roll my changes from that org into dev, and from dev into packaging. That works fine until the scratch org expires, which apparently it just did. Now I cannot log into it, and my dev is suddenly halted. There were no warning emails received (maybe he did, but didn’t tell me) and no way to re-enable the org. It’s just not accessible anymore. Thank goodness I have local copies of my code (we haven’t really gotten version control integrated into our workflow yet) or else I’d have lost any work.

I now have to set out to get a new org setup (when I’m already late for a deadline on some fixes). Fine, so I attempt to create a scratch org from my own personal dev org (which itself is halfway broken, it still has the theme from before ‘classic’. Enabling lightning gives me a weird hybrid version which looks utterly ridiculous).

I enable dev hub and set out to create my scratch org from VS code (I’ve never done this so I’m following a tutorial). So I create my project, authorize my org, then lo and behold, an error occurs while trying to create my scratch org “ERROR running force:org:create: Must pass a username and/or OAuth options when creating an AuthInfo instance.” I can’t find any information on how to fix this, I tried recreating the project, reauthorizing and still nothing. Not wanting to waste anymore time, I say fine I’ll just create a regular old developer org, install the un-managed package and enable person accounts.

I create my new dev org (after some mild annoyance and not being able to end my username with a number) and get it linked to my IDE. So now I need to enable person accounts, but wait you cannot do that yourself. You have to contact support to enable that and guess what Salesforce no longer allows you to create cases from a developer org. Because this package is being developed as an ISV type package I don’t have a prod org to login to create a case from. So now I’m mostly stuck. I’ve asked a co-worker who has access to a production org to log a case, and giving them my org ID, I’m hoping support will be willing to accept a feature request for an org other than the one the case is coming from. Otherwise I don’t know what I’ll do.

I’m sure once things mature more it’ll get better, and a good chunk of these problems are probably my own fault somehow but still, this is nuts.

8 responses

  1. Some times, when ever I try to use full potential of salesforce platform features(any admin/dev), it gets screwed up somewhere even I obey all best practices and governor limits.

    I think every developer has aware these dark sides of salesforce platform and may faced such challenges in their projects as well.

    April 25, 2019 at 1:19 pm

    • Yeah, I mean I do my best to follow along with how they want things done but sometimes it seems like just hacking together my own path works better and with much less hassle. Like I want to do things the official cool kids way but I just don’t have the time or energy to screw around with half cocked broken ass tech.

      On the semi bright side I did manage to get person accounts enabled so I’m finally doing work again. They are still terrible, and break all my logic for how accounts and contacts should work (which is partially due to the terrible API I’m dealing with as well). With any luck I’ll be done with this project soon and can escape this living hell.

      April 26, 2019 at 1:41 am

      • Agree with you 🙂

        April 26, 2019 at 7:01 pm

    • We’re just not allowed to talk about them for fear of retribution from the messaging and branding police.

      April 26, 2019 at 2:37 pm

      • I’ve never been afraid to speak honestly about my views. While I don’t want to come across as negative I do feel like sometimes the SF world is a little bit ‘head in the sand, everything is wonderful’ feeling. If nobody can point out flaws or shortcomings because they are afraid of some kind of public backlash that ends up being just controlling the dialog through fear which I am not about. Sometimes things are bad and broken. It’s important to be able to point that out constructively of course (I know this blog post was bordering on venting but I’m human, and was pretty frustrated) so attention can be paid to the issues and they can be resolved.

        April 26, 2019 at 3:30 pm

  2. Makes you wonder how many of these prescriptive “happy paths” that are recommended to us are ever tested at all.

    April 26, 2019 at 2:36 pm

    • I’m sure when it works right it’s all pretty cool. Granted the learning curve is kinda steep but that’s mostly okay, such is life in tech. Just when we’ve all got clients with deadlines it’s really not okay to have so many issues and setbacks. It makes the firm I work for look bad, it makes me look bad, in makes the platform look bad. If they are going to prescribe a way to do things, and pressure folks into doing it that way, it damn well better work. Again, I’m not trying to be overly negative, and it’s impressive what they are trying to build and when it all comes together properly its gonna be sweet. It just doesn’t seem mature enough but yet it seems like if you aren’t on board then you are made to feel like your stuck in the past.

      April 26, 2019 at 3:35 pm

      • Totally get it. I’ve been going through this more and more over the past few years, especially with the moving target known as “Lightning.” I didn’t take this post as venting…I’m sorry you had to go through this ordeal, but what you went through is not atypical and I appreciate you documenting it.

        It’s one thing to feel the frustration of a learning curve – which we all have to – but it’s another to have to feel the frustration of something that you’re told works, only to find it doesn’t. Workarounds should only need to be used to work around deficiencies…not things that you’re told are supposed to work and are given explicit instructions on how to make work, only to find that they don’t work at all.

        April 26, 2019 at 7:56 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s