Hello admins! Today we have an exciting announcement to share with you, and a Pro Tip you can use with App Scripts!
🚀 New & Improved App Script Documentation is Live!
We’re excited to announce that the App Script documentation in the TrackVia Help Center has been completely revamped! Whether you're just getting started or looking to build more advanced automations, the new articles offer clearer explanations, practical examples, and updated guidance to help you unlock the full power of App Scripts in TrackVia.
Explore the updated resources here: 👉 New App Script Help Articles
We’ve restructured everything to be easier to navigate and more helpful at every step—from understanding core concepts to deploying scripts that enhance your app’s capabilities.
Check it out today and take your app automation to the next level!
Take a look at a couple of examples from the new and improved App Script Example Library below!
🎓App Script Pro Tip: Use the Safe ? Operator to Avoid Errors Caused by Null Values
Refer to the Script Writing - Using Operators article for more information.
Do you have any scripts that take a value from a linked Parent Record’s field and stamp it into a field on the child record like the example below?
if(currentValues[“Link to Parent”]{
currentValues[“Field 1”]= currentValues[“Link to Parent”][“Parent Field Name”]
}
If so, you’ve probably noticed that the script will throw an error if any of the field’s values are null, and so you’ve had to add null checks to your script to avoid the null errors.
Instead, try using this shorthand method using the Safe Operator to avoid running into errors due to null values, while also making your scripts easier to read:
currentValues[“Field 1”]= currentValues?[“Link to Parent”]?[“Parent Field Name”]
🎓App Script Pro Tip: Replace Repeated Sections of Script with a Custom Function
Refer to the Script Writing - Using Functions article for more information
Do you have a script that frequently compares a field’s currentValues to previousValues like this?
if(currentValues[“Field Name”] != previousValues[“Field Name”]){
//Perform some action}
If so, you can simplify your script with two simple steps:
Step 1 - Change those sections of script to this:
if(isDifferent(“Field Name”)){
//Perform some action}
Step 2 - And add this custom function at the bottom of your script:
def isDifferent(String fieldName) {
return currentValues[fieldName] != previousValues[fieldName]
}
Comments
0 comments
Please sign in to leave a comment.