8. Introduction to Functions1. About This Course

1 - About this course

This content is also available at learn.palantir.com ↗ and is presented here for accessibility purposes.

So far, you’ve been working with interfaces that abstract away code elements; Workshop, OMA, Object Views are all are “no-code” environments. What about when Application developers may want to add custom business logic that exceeds the native features of Ontology-aware applications? In these cases, you can write Foundry Functions to develop and publish centrally-managed, reusable logic. Learning to write and integrate Functions into your workflows is an integral part of the builder experience, because it permits you to extend the capability of your applications through the Ontology API.

⚠️ Course prerequisites

  • APPDEV 07: Intro to Actions: If you have not completed the previous course in this track, do so now.
  • Familiarity with Foundry Code Repositories. If you have not yet used a Foundry code repository, we recommend familiarizing yourself with the Code Repository interface.
  • Necessary permissions to edit your organization’s ontology, Object Views, and Workshop modules. Depending on your organization’s governance, not all users may have each of these levels of access. If you don’t have these levels of access and believe that you should, contact your program administrator or Palantir Support.

Outcomes

The goal of this tutorial is to provide hands-on examples of at least three ways to use Functions to enhance your applications. At the end of this training, you will have augmented your Workshop module with the following:

  • A metric card that calculates the percentage of unresolved alerts.
  • New columns in your flight alert object table with departure and arrival delay information.
  • An Action permitting bulk compensation for affected passengers based on qualitative analyst input.

Functions are written in TypeScript ↗, which is a programming language built on JavaScript. In this tutorial, you’ll encounter examples instructing you to copy/paste TypeScript code snippets into your editor—often without a full explanation of the syntax. It is not the purpose of this course to teach you to write TypeScript code. For that, consult the numerous online TypeScript reference material and training. The Foundry documentation offers further examples of using TypeScript with the Foundry Ontology API.

Learning Objectives

  1. Understand the general structure of a Foundry Function.

  2. Practice writing, publishing, and using these types of Functions in your applications:

    • Custom aggregations and metrics
    • Derived values
    • Ontology edits

Foundry Skills

  • Writing, publishing, and implementing TypeScript Functions.
  • Creating and implementing:
    • A custom aggregation
    • A derived value column
    • A Function-backed Action