***Note: For TrackVia Admins & Super Admins *** If you aren’t a TrackVia admin, this likely won’t make much sense to you. But if you’re interested in what app scripts in TrackVia can do – feel free to read on!

Thanks to TrackVia, you can emerge as an architect of accelerated growth within minutes, all without writing a single line of code – that’s the power of Low Code/No Code! Now, imagine dedicating just a few extra minutes to crafting concise, user-friendly lines of code behind your core tables – elevating both your processes and results. If you’re intrigued, you’re on the verge of unlocking a world of potential with the power to enhance your TrackVia workflows.

For those driven by curiosity, take my virtual hand, and let me guide you through a common use case through (just a few!) lines of code.

Have you ever wanted to track the ever-changing status of a record? Or keep tabs on any changes happening within a record? With a straightforward app script, you can do just that. We’re going to take you through the process of how to get real time tracking on changes with app scripts. Let’s get started!

Preliminary Set Up

Before we really dive in, there are a few preliminary to-dos you’ll want to ensure are in order:

1. First, you’ll want to access the Script Editor (this is where you’re going to be making the magic happen). To do this, you’ll go to your parent table’s Table Builder and select “Application Scripts,” next to “Microservices”:

2. Next, you’ll select your trigger event (when you want your script to execute). This will either be before or after a record is added, updated, or deleted. Refer here for more information on which event makes the most sense for your use case.

3. Last, you’ll need to define your constants. Take a peek at this helpful article for a quick overview of what constraints are and how they’re used within the Script Editor. In a nutshell, constants are the underlying ID of a field. Whereas a field’s name can change, this underlying ID will always remain constant. You can access all the constants within your app by clicking the arrow on the far-right side of the Script Editor:

If you’re still with us, congrats! You’re one step closer to writing your first lines of code.

Create a Historical Log of Record Changes

Let’s examine this use case where the administrator wants to create a running log of their employees’ work hours. This involves a parent table where the hours are input, and upon saving, an app script is triggered. This script generates a new entry with the parent fields’ contents on a child table.

The Setup: Make sure you have the parent table built and a child table prepared to receive the parent’s information. See here for more details on how to establish this relationship.

The Knitty-Gritty: The script we’ll be writing will include a few things. Apart from the constants, you’ll need:

  • The Map. This map will hold the parent constants we are pulling the data from, and the child constants for storing the data.
  • The ‘if’ statement: We don’t want this to run any update to a record, do we? Most certainly not, so we’ll want to include a field that must be updated on the record for this script to run. This could look like a drop-down that contains the option ‘Create History Log?’ that is then nullified at the end of our script.

Below is the script I’ve written on my parent table:

The Walk-Through:

Lines 3-15: We begin by adding our constants to the top – You’ll want to make sure you grab all of the constants you need so you can reference them in your scripts.

Lines 17-21: This is our Map (where we are going to be storing the parent data).

The format is:

Map (Map Variable Name, this can be whatever you like!) = [

(child Constant): currentValues[parentConstant],


Line 20: The hoursParentRelx constant (pulled from the Child table’s list of constants) is looking at the relationship between the child and the parent. We are setting this to only ‘currentValues’ since we’re only pulling this relationship down to the child record. No need for the relationship constant to be added twice (i.e. (hoursParentRelx): currentValues[hoursParentRelx]).

Line 23: This is our ‘if’ condition. This ‘if’ statement is saying: If there are contents in the ‘Create Hours Log?’ field (currentValues) and there was nothing there before the update to the record (!previousValues), do the following:

Line 24: Save the newHoursLog Map we created above to the Hours Child Table.

The format is:

 save((TableWeAreSavingTo), the Map variable, (theApplicationWeAreIn)) as Map

Line 25: Finally, we are nulling the current contents within the ‘Create Hours Log?’ drop-down field so it is ready to create more child records!

The Outcome

There you have it! And this is just the tip of the iceberg when it comes to the potential that app scripts hold for optimizing your workflows. If you’re hungry for more, this TrackVia University course is perfect for comprehensively exploring the capabilities of scripts and their adept use in automating your workflows. Cheers to revolutionizing your TrackVia experience!

Looking to get more out of your TrackVia applications? Contact TrackVia Services for specialized help with your apps, or get your admin certification training through TrackVia University.

TrackVia University Link

track everything.
build anything.

TrackVia is the no-code business app creation platform for innovators in any department. Start a free trial and create the solution to whatever challenge is in your way.

What will you build today?

  • TrackVia Low Code App Builder Line Chart with Inspection Dates
  • Low-Code App Builder Project Status Bar Chart
  • Low-Code App Builder Task Status Pie Chart
Skip to toolbar