We’re excited for the upcoming Salesforce Winter ‘20 Release! Our team came up with a list of functionality that will change how our customers and partners will work, learn, and collaborate. New Salesforce Mobile App Build custom apps with ready-made or custom components, and change the look, feel, and functionality to make your data work […]
At Dreamforce 2018, I presented on Continuous Integration with Salesforce DX and Bitbucket. My presentation introduces Bitbucket Pipelines and talks about some of the prerequisites for setup. Bitbucket Pipelines is an integrated continuous integration service, built into Bitbucket. It allows you to automatically build, test, and even deploy your code, based on a config file […]
Modelit is proud to offer CRM Consulting and Web Development solutions for companies. As a compact, Montevideo, Uruguay-based company specializing in Salesforce, we strive for customer success and satisfaction. Through timely and quality project development, we will help you launch your products faster. Featured in a Harvard Business Review article, well-executed CRM is crucial to […]
The Builder Pattern is a software design pattern intended to add more abstraction to the instantiation of Objects, where you can preset certain steps of the process simply by, setting some properties with default values coherent with the context of the execution. Say you have a Custom Object with several required fields, but you need […]
When we start working in a project that was previously developed by another company, we could fall in the disgrace that the code was written by more than one developer without agreeing in the same practices, something that we can fix with some regular expressions (regex) within Atom. In the examples below I decided how the code should looks like […]
Salesforce-Python Problem: Two weeks ago or maybe more our clients from California requested a script to parse a xml file (Salesforce-Python). After parsing the xml we had to get some data from it and update some Salesforce records using that data. Salesforce-Python: Why Python? Python is a short syntax language (fast coding). We didn’t have to […]
Automating Git tasks is not about hooks or aliases, that’s a story for another day.
Let’s imagine for a second that you are a lazy person, not too lazy, but lazy enough to get a little upset every time you need to, let’s say, update your beautiful working repository or even cheat on your SEO configuration by mentioning ‘Automating’ out of nowhere (see what I did here?). You can’t mess it up, because you and your team are so proud of the beautiful branching model you achieved and you treat merge commits as if they were bitten by a zombie.
But, of course, to achieve that ‘Good Practices of the Month’ badge and be delighted with the output of your git log you need to do some tricky stuff on a daily basis.
Let’s continue with our imagination exercise, and imagine this workflow:
- You work in a feature branch for every story
- That branch is checked out from ‘develop’
- All the commits created in the feature branch must be taken to ‘develop’ at the time they’re created
- Obviously, those commits, need to be synched with the ‘upstream’ and ‘origin’ remotes
- Once that feature branch is done it is merged with a third one, ‘staging’, ‘qa’, ‘release’, whatever
- You hate, absolutely hate, merge commits
So, that comes with some tricky implications: if you don’t want merges in your ‘develop’ branch, and don’t want to get the ‘develop’ commits to the feature (since they might have zero relation with your work) you’ll need to git rebase your changes from the feature to ‘develop’ instead of just merging it.
That means, for example, we need to:1234git fetch upstreamgit merge-base develop upstream/developgit reset --hard <SHA-returned-by-the last command>git merge upstream/develop
That’s four commands every time you want to get the latest changes.
Remember: You are lazy.
But wait! There’s hope, because, in case you didn’t notice: git is awesome.
So, here’s the thing, git has this awesome feature, where you can write a script, add it to your PATH and make git to run it. Just like that.
First, you need a file named ‘git-whatever’ it doesn’t need an extension, and must be named with the ‘git-’ prefix.
I recommend to place it inside an specific folder and add the folder to the PATH, since you may want to store many files in there.
So, what’s inside the file? Well, it must begin with the address of the interpreter for the scripting language you’ll use. Just a hint: the git installation folder comes with an sh interpreter for free!
#!/bin/sh // That’s the generic route for git’s own sh interpreter
After that, you just can do whatever you want, assign variables, control the execution flow, iterate and the most important thing: set the git commands you need to run every time.
Here’s an example for a script that helps automating the job described above, fetches the upstream remote, finds the newest common commit, resets to that point and merges from there:Shell12345678910111213141516171819#!/bin/shbranch_name=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')echo "Current branch is $branch_name"echo "Fetching upstream..."git fetch upstreamecho "Getting the common ancestor with the remote..."common_ancestor=$(git merge-base $branch_name upstream/$branch_name)echo "Resetting your branch to the best merging point..."git reset --hard $common_ancestorecho "Merging your remote branch..."git merge upstream/$branch_nameecho "All done!"exit 0
Now, all you need to do is go to your repo and ‘git whatever’.
I will try to explain to you a how DAO is a better approach to connect to MySQL through PHP, making the code readable and secure at the same time. Change our connection from mysql_connect() to new mysqli(): Imagine we have a connection.php file. Typically it looks like this:PHP12$con = mysql_connect('localhost', 'myuser', 'mypass');mysql_select_db('mydatabase_name', $con);
Instead of this we could change it into […]
Test your SQL analysis skill. An order can have multiple lines – For example, if a customer ordered cookies, chocolates, and bread, this would count as 3 lines in one order. The question is to find the number of orders in each line count. The output of this query would be something like 100 orders had 1 line, 70 […]
As Salesforce Administrator/DevOps, you might stumble to common situation where you have to mass-update or mass-delete specific records with complex filtering criteria and deep Salesforce object relationship (parent, child, or grand child). Of course, if you are an expert in Apex programming, you could write long and complex nested SOQL queries to get the record […]
The big news is that Modelit has just launched this website. Welcome! You’re among the first visitors to come to our doorstep and read these pages. We now have a place to call home—our virtual home, that is. You might be curious to see what we’re all about, someone may have told you about our […]