Course Catalog Help
APPDEV 08: Intro to Functions

APPDEV 08: Intro to Functions

Write Foundry Functions to develop and publish centrally-managed, reusable logic.

rate limit

Code not recognized.

About this course

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, please 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, please reach out to your program administrator or Palantir point of contact.
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, please 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

Curriculum

  • About this course
  • Your Functions Repository
  • Opening a TypeScript Repository
  • The Anatomy of a Function
  • Unit Tests
  • Importing Your Ontology Types
  • Exercise Summary
  • Writing and Using a Custom Aggregation
  • Writing a custom aggregation Function
  • Testing your custom aggregation Function
  • Publishing your Function
  • Using Your Function in a Workshop Module
  • Exercise Summary
  • Generating a Derived Column
  • Writing a derived column Function
  • Testing and publishing your derived column Function
  • Implementing your derived column in Workshop
  • Exercise Summary
  • Function-backed Actions
  • Writing an Ontology Edit Function
  • Testing and Publishing Your Ontology Edit Function
  • Backing an Action with a Function
  • Configuring your Function-backed Action Form
  • Adding Action Security and Submission criteria
  • Implementing Your Voucher Action in Workshop, part 1
  • Implementing Your Voucher Action in Workshop, part 2
  • Implementing Your Voucher Action in Workshop, part 3
  • Testing Your Voucher Action in Workshop
  • Exercise Summary
  • Conclusion
  • Key Takeaways
  • Next Steps

About this course

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, please 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, please reach out to your program administrator or Palantir point of contact.
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, please 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

Curriculum

  • About this course
  • Your Functions Repository
  • Opening a TypeScript Repository
  • The Anatomy of a Function
  • Unit Tests
  • Importing Your Ontology Types
  • Exercise Summary
  • Writing and Using a Custom Aggregation
  • Writing a custom aggregation Function
  • Testing your custom aggregation Function
  • Publishing your Function
  • Using Your Function in a Workshop Module
  • Exercise Summary
  • Generating a Derived Column
  • Writing a derived column Function
  • Testing and publishing your derived column Function
  • Implementing your derived column in Workshop
  • Exercise Summary
  • Function-backed Actions
  • Writing an Ontology Edit Function
  • Testing and Publishing Your Ontology Edit Function
  • Backing an Action with a Function
  • Configuring your Function-backed Action Form
  • Adding Action Security and Submission criteria
  • Implementing Your Voucher Action in Workshop, part 1
  • Implementing Your Voucher Action in Workshop, part 2
  • Implementing Your Voucher Action in Workshop, part 3
  • Testing Your Voucher Action in Workshop
  • Exercise Summary
  • Conclusion
  • Key Takeaways
  • Next Steps