.ultrageek. Computers, Music, and Thoughts


Network Solutions – Nothing ever Changes

Back in 2015 I moved all my domains over to Google mainly because for 12$ a year they'll maintain my domain registration, run my DNS, and give me free email ala gmail and at the time I was still hosting my own email, DNS, and web and the email maintenance was just too much specially the never ending spam battle. I wrote back the experience in this post: Transferring Domains - Godaddy vs. Network Solutions.

Well recently Network Solution had a security breach so I logged in to see if I had any domains left which I did, an administrative domain that I kept in case the transfers to Google went sideways for some reason. Long story short I kicked off the transfer and sure enough...the same experience I reported back in 2015 is still the case. The same 4 screens and 3 day waiting period. Sometimes posts do not age well, this one sadly is becoming a timeless classic.

BTW quick update - I also had a couple domains still at Godaddy and they were still super easy to move over. Godaddy sends your code to you immediately and Google still makes it SUPER transfer domains over.


Running CSVFIX on Mac

CSVFIX has been my go to for command line ETL but I have always run it on Windows. After running in to some issues with a CSV file loading in to Salesforce I needed something on the mac to 'peak' in to the file and do the usual amount of stuff that I'm used to doing with CSVFIX. A quick google search and I find some handy instructions but nothing is ever easy and because the internet sometimes comes and goes I'm putting those here with the changes I made to work on Mac (vs. Linux) and a couple of the apps I had to update or install.

Here's the list of commands:

  1. wget https://bitbucket.org/neilb/csvfix/get/version-1.6.zip
  2. unzip version-1.6.zip
  3. cd neilb-csvfix-e804a794d175
  4. make lin
  5. cd csvfix/bin
  6. sudo cp csvfix /usr/local/bin

Wget by default is not on the mac. I used "brew install wget" to install it. It is a handy package manager that is specifically for Mac: https://brew.sh/

On step #4 when you try and 'Make' or compile you might get this error:

  • xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

To fix this run: xcode-select --install and that installation will fix the error and allow you to compile/make csvfix.

The last thing that I changed from the original instructions is to update step #6 from /usr/bin to /usr/local/bin which is specific to mac (vs Linux).

Here is the link to the blog post that started this journey: Install csvfix on linux


Tagged as: , No Comments

Silly Dev Trick: Running Lead Assignment Rules on New Leads

Another posting that resulted from a lot of great examples on the web but none that were actually bulked and tested.

So the business case is "Run the default lead assignment rules when leads are created". Seems easy but when you look at the documentation, forums, and blog postings it is all none bulked examples with all kinds of answers for how to bulk. The issue I kept hitting was this error:

"DML statement cannot operate on Trigger.new or Trigger.old"

Wait what? Works fine if you just update the record but if you added it to a list blamo. Someone mentioned future class as an option but that involves all kinds of overhead for catching when the queue is full and managing that. So noodling the error message I decided to give a "what if sObject?" and that works like a charm. Calling the class on After Insert.

Below is an example class that is tested and works. Created a checkbox to manage resubmissions/looping but other than that it's pretty straight forward:


Silly Dev Trick: Converting Ids from 15 to 18 Automagically in Apex

Anyone that has dealt with Opportunity Line Items knows that you cannot create a lookup to that record on another. So the next best thing is to put a text field and store the Id. Apex stores Ids in their 18 length form but in the UI it shows it to you as 15 digits. Since it is not uncommon for folks to update data manually I needed a quick way to 'fix' Ids from 15 to 18 in apex like CASESAFEID. Workflow would have worked...but let's pretend it didn't heh.

Here's a quick trick to convert those 15 digit text ids back to 18:

string idStr = '001E000000nwg7g';   // 15 character id
id idval = idStr;                   // assign to ID variable
idStr = idval;                      // back to string to prove the point
system.debug('18 char: ' + idStr);  // note that you could just append idval instead
                                    // of converting to string first

Got this trick from this awesome Stackexchange post: https://salesforce.stackexchange.com/questions/25575/casesafeid-apex-equivalent

As usual this was a little harder to find than it should have been.


Apex sObject Examples

sObjects are great for dynamic apex where you need to re-use code across objects and/or need to dynamically set data. I've had several projects where the same logic is used across many objects such as date, territory, and ownership. Recently had a use case where I used sObjects and a custom setting with a list of fields between two objects to dynamically load the fields and keep data synchronized. Going to clean up that example and posted it later but below is a cheat sheet I finally pulled together of common programming patterns and uses:

Tagged as: , No Comments

Salesforce Quick Action: Setting the FROM Email Address using a formula

Business Case: Client has a lot of email-to-case addresses and wants their quick action 'From' to be preselected in order to cut down on clicks and ensure the email goes out from an address that is not the agent and that will be returned directly to Salesforce. Seems easy enough! When looking at the predefined field values for the email quick action it can get confusing as to which one to use and the correct formula to use so here's how I solved it:

if(ISPICKVAL(Case.Origin, "Product_Name_1 Email"),
if(ISPICKVAL(Case.Origin, "Product_Name_2 Email"),

The trick was using the 'From' field AND NOT the 'From Name' or 'From Address' AND using only the email address and not the name or name + email address (believe me I tried both). It was looking at the html source code of the New Predefined Values page that clued me in. Predefined Field Values on picklists are just so awesome!


Silly Admin Trick: Showing the User License in List Views and Reports

Todays silly admin trick which you can find in 2 seconds on google is how to get the license of the user in Salesforce to show up in a list view or in reports. Once you see the answer it is a no brainer but:

  1. Create Formula field -> Text
  2. Name it something like: License Type
  3. Copy/Paste: Profile.UserLicense.Name
  4. Viola!~

Makes total sense to dig in through the profile's related license to determine the users license but would be handy if this was a standard field in Salesforce.


Silly Admin Trick: Disable Customer Portal Navigation Bar

In Salesforce Classic when you create your first community (Customer Portal) Salesforce puts a black navigation bar at the very top of the page that allows you to quickly toggle between the standard user interface and your customer portals. It...is annoying and for some reason since I rarely run in to this I forget how to disable it so once and for all:

Profile: Global Header -> Uncheck

Go in to User Management Settings and turn on Profile List Views if they're not already turned on and then create a list view with that attribute to mass turn off. I can see how this would be helpful for testing but for users it is pretty useless and confusing.


Mass Edit Button for Lightning Related List

Inline editing is super easy in Salesforce Lightning but not from a related list on a record page. So this is a quick and easy way to without a controller create a VF page that can be used as a button to update a field selected records in a related list. Just flip the object name and fields and you are off to the races. And this example is straight off of the Salesforce site examples but I removed the extension class so that a test class is not necessary.

Update Nov 2019 -Here are the steps:

  1. Create the VF page, make sure to go in and make it available for Lightning (Available for Lightning Experience, Lightning Communities, and the mobile app)
  2. Navigate to the related list object in setup
  3. Buttons, Links, and Actions --> New Button or Link
  4. Click 'Display Type' to 'List Button' and make sure to keep the 'Display Checkboxes' checked on/true
  5. Click the 'Content Source' to 'Visualforce Page' and then in Content select the page you created. Add the Name and Label and Save
  6. Navigate to the parent Object whose page layout will show the child related list (the object that you just created the button on)
  7. Click Related Lists, click the wrench of the related list, like the 'Buttons' section to expand, and then click and add the new button you created
  8. Ok / Save / Done

Mass-Updating Records with a Custom List Controller

StackExchange post: https://salesforce.stackexchange.com/questions/146973/run-a-mass-action-on-multiple-records-in-a-list-view


Apex Class working with both Trigger and Batch

Sometimes there is a need for a class to execute based on a record value (checkbox) or as part of a scheduled batch job. Not a new concept but you will get this error: Static method cannot be referenced from a non static context

So a quick fix is to just create a non-static method that calls the static method...crazy that this works but it does.

Again - nothing magical or new here but in case google was not giving you the results here is one solution.


Tagged as: No Comments