I love how Outsystems helps me to develop apps quickly. However, along my journey, I've discovered a handful of tips and tricks that have made my life as a developer more enjoyable. Over the past two years, I've been gathering these "lightbulb moments" and learning experiences, and now, I'm thrilled to share them with you. If you had a similar moment, don't hesitate to share it at my LinkedIn!
Tip 1: Use unique indexes to prevent duplicate data
One of the blessings of OutSystems is its simplicity in creating tables and performing database actions. However, if not approached with caution, this blessing can turn into a curse. I learned this the hard way when I encountered data duplication issues. To prevent duplicate records, especially in one-to-many relationships, utilize unique indexes. OutSystems provides documentation on this topic, which you can refer to for implementation details. Additionally, you can find more data modeling tips here.
Tip 2: Use delete rules
Continuing with the topic of data modeling, let's talk about delete rules. These rules can be configured for the foreign key attributes of entities, determining the actions to take when a referred record is deleted. While I won't delve into the details here, Joey Mooree has done an excellent job explaining this concept on the forums. It's important to note the power these rules hold. Setting a delete rule to "Delete" initiates a cascading delete, which can be potent but may lead to performance issues, such as transaction timeouts. In many cases, I find myself opting for the "Protect" delete rule most of the times to ensure data integrity.
Tip 3: Use descriptions
When developing in Outsystems, code legibility should be high on your list. Especially if you're working in a larger team. To enhance code understanding at a glance, leverage clear descriptions throughout your application. Whether it's action node labels, attribute descriptions or input parameters, use descriptions that make sense. Go beyond merely repeating their names, but instead explain typical use cases, provide business examples, or describe the transformations being performed
Tip 4: Use Remove unused dependencies
Here's a quick win for your architecture: utilize the "Remove unused dependencies" feature. As someone who occasionally ends up with nonsensical references to entities or actions due to copying components, I've found this feature to be invaluable. Simply right-click on your module and select "Remove unused dependencies" to keep your dependencies tidy and your application optimized.
Tip 5: CTRL + SHIFT + CLICK to select part of an Action flow
When working with action flows in Service Studio, selecting a specific section to move or edit can involve a lot of scrolling. However, here's a neat little trick I frequently use: hold down the CTRL + SHIFT keys and click on a node within your action flow. This action will automatically select all subsequent nodes in that flow, making it easier to manipulate specific sections without excessive scrolling.
Tip 6: Count(*) over()
For the SQL enthusiasts out there, here's a recent discovery that might interest you. While OutSystems recommends creating a separate SQL query instead of using the count attribute within the original output, I often found myself frustrated by the overhead of maintaining double the number of queries. Thankfully, there's an alternative solution: using the "COUNT(*) OVER()" construct in your SELECT columns. This SQL server feature returns the total count of all matching records within each row. By incorporating this into your queries, you can access the count through "List.Current.TotalCount" and avoid the need for additional queries. You can find detailed technical aspects of this feature in the tutorial provided by MSSQLTips.
Tip 7: Server-side dropdown
OutSystems recently introduced the Server-Side dropdown, a powerful widget that integrates standard components such as a search box, lazy-loaded lists, and an action footer. It offers extensive customization options and is particularly useful when dealing with large datasets. For instance, if you need a dropdown containing thousands of customers, utilizing the lazy-load pattern combined with search functionality ensures swift loading of your page, eliminating the need to retrieve all customer records at once.
Tip 8: Configure Label attribute for scaffolding
Scaffolding is great for quickly generating screens and forms. However, to ensure accuracy and user-friendliness, it's beneficial to configure the Label attribute on entity and structure attributes. By doing so, OutSystems generates the appropriate labels in your forms automatically, saving you time and effort.
Tip 9: Use developer tools
This tip is not exclusive to Outsystems developers, but a web developer essential. Most modern browsers, like Chrome and Firefox, include browser developer tools which offer invaluable insights into every aspect of your web application. For example, Chrome's Application tab allows you to view local storage usage, while tools like Lighthouse enable you to audit performance and resource utilization. Investing some time in exploring and familiarizing yourself with developer tools will undoubtedly pay off in terms of debugging and optimization.
Tip 10: Set static entity identifiers manually
Static entities are great for enumerations, but it's important to remember that they are, in essence, database tables. To ensure identifiers are consistent across environments, set the "Auto number" attribute of the identifier to "False". This approach eliminates the need for translation or interpretation of data when working with static entities across various environments.
Remember to share your own insights and experiences by connecting with me on LinkedIn. Together, let's push the boundaries of OutSystems development!