Skip to content

Project Structure

A Custom Gizmo project is a flat list of files stored in KnowledgeLake. There are no folders. Every new project starts with five files, and every import must contain the same five. This page explains each file, how to add your own, and how export and import treat them.

At a glance

  • You edit index.html, main.js, whitelist.txt, plus any files you add
  • Generated gizmo.json (schema and permissions) and project.json (title and file flags)
  • Project paths Start with {project}/, ./ or /
  • Export and import One zip, all files at the root

The five files

File Purpose
index.html The page the gizmo loads first. Reference your scripts, styles and images from here. You edit it.
main.js Your gizmo code. Saving it regenerates gizmo.json. You edit it.
whitelist.txt The outside origins the gizmo may call or load from. See Security and Sandboxing. You edit it.
gizmo.json The input schema and declared permissions. Generated, read-only.
project.json The project title and file flags. Generated, read-only.

All five files are locked: you cannot delete or rename them.

gizmo.json

When you save main.js, the editor runs your gizmo and asks it for its schema (SetInputSchema) and its permissions (DeclarePermissions). It writes the answer here:

gizmo.json
{
  "permissions": ["openapi_api_ft_manage_workitems"],
  "schema": { }
}

schema holds the serialized input schema. Its inner format is internal; read it, but do not hand-edit it. The task layout designer reads this file when you add the gizmo to a layout. If main.js throws an error at load time, the schema can come out empty. Fix the error and save main.js again.

project.json

project.json
{
  "ProjectTitle": "Greeting",
  "LockedFiles": ["index.html", "main.js", "whitelist.txt", "gizmo.json", "project.json"],
  "ReadOnlyFiles": ["gizmo.json", "project.json"],
  "BinaryFiles": ["logo.png"]
}

The editor rewrites this file when you save the project. On import, it sets the project title and the flags of each file.

Adding your own files

You can add files in the editor or upload them, for example style.css, helpers.js or logo.png. Reference them from index.html with a project path:

index.html
<link rel="stylesheet" href="{project}/style.css">
<script src="{project}/helpers.js"></script>
<script src="{project}/main.js"></script>
<img src="{project}/logo.png" alt="Logo">
  • A URL that starts with {project}/, ./ or / is read as a project file. Other URLs are left alone.
  • File names are matched without regard to case.
  • Files are served with a type that follows the extension: html, js, json, css, png, jpg, jpeg, bmp, gif, svg, pdf. Any other extension is served as plain text.
  • The runtime re-inserts each script from index.html, so scripts can finish loading in any order. Do not call code from another file at the top level of a script. Call it from OnShow.
  • Images and other binary files are stored as binary when you upload them, and served with their real type.

Export

In Configuration › Services › Custom Gizmos, use the Export action on a gizmo's row. You get a zip named after the gizmo title, for example "Greeting - Custom Gizmo.zip", with every file at the root.

Import

Select Import Custom Gizmo and drop one zip file.

  1. The zip must contain index.html, main.js, whitelist.txt, gizmo.json and project.json. If one is missing, the import fails with "File selected for import is not a Custom Gizmo".
  2. Folders inside the zip are ignored. Each file is stored by its file name only, so two files with the same name in different folders collide.
  3. The five required files are always locked. gizmo.json and project.json are always read-only.
  4. A file is imported as binary only if project.json lists it in BinaryFiles.
  5. Import creates a new gizmo. It does not replace an existing one, and layouts keep pointing at the old gizmo.

Gotchas

Watch out

  • Images break after export and import. The editor can record a binary file under ReadOnlyFiles instead of BinaryFiles. Before you import, open project.json in the zip and make sure every image is listed in BinaryFiles.
  • A layout still shows the old version. Import made a new gizmo. Edit the original, or replace the gizmo in each layout.
  • Changed permissions do not reach the layout. The layout copies the permission list when you add the gizmo. After you change DeclarePermissions, remove the gizmo from the layout and add it again.
  • A script path without a prefix. <script src="main.js"> is not rewritten and does not load. Use {project}/main.js.