For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create Blocks

Include blocks in your Kizen app to display custom content tiles on dashboards, homepages, chart groups, and record details pages.

Overview

Blocks are tiles of content that sit in dashlet grids on dashboards, homepages, and chart groups (see Figure 1).

 A block from an app displays a randomly generated funny affirmation on the Dashboard page in Kizen.
Figure 1: A block from an app on the Dashboard page.

Blocks can also appear on record details pages (see Figure 2).

The user has added the same block to a record details page in Kizen.
Figure 2: The same block on a record details page.

After a user installs your app, they can place your blocks among their existing dashlets and content on these four types of pages.

The content of a block can come from custom HTML, or you can embed the content from a page on the web.


Add a block to your app

Add your block to the blocks directory in src. Place each block in its own subdirectory with config.json, script.js, and styles.css files as needed, like this:

Note: Depending on the block, you might not need styles.css. See the table below for details.

The following table describes these files:

File
Type
Purpose
Required?

config.json

JSON

The configuration file for the block.

Yes

script.js

JavaScript

The script that runs when the block loads.

Yes

styles.css

Cascading Style Sheet

The styles for the content in the block. If the block embeds content from an outside source, you don't need this file.

No

Blocks also support event scripts. Place event scripts in the block's eventScripts subdirectory. For more information about event scripts, see the coding reference.

See below for details on each of these files.

About config.json for blocks

The configuration file for a block sets the properties of the block:

The keys are as follows:

Key
Description
Required?

name

The name of the block.

Yes

api_name

The API name of the block in all lowercase letters. If you don't specify a value for this key, the system automatically generates one based on the name of the block's subdirectory.

Yes

min_w

The smallest allowable width of the block in grid columns (1–12). This key applies to blocks of the charts, dashboards, and homepages types.

No

max_w

The largest allowable width of the block in grid columns (1–12). This key applies to blocks of the charts, dashboards, and homepages types.

No

min_h

The smallest allowable height of the block in grid rows (1–24). This key applies to blocks of the charts, dashboards, and homepages types.

No

max_h

The largest allowable height of the block in grid rows (1–24). This key applies to blocks of the charts, dashboards, and homepages types.

No

recommended_height

The default height of the block in pixels (100–800). This key applies to blocks of the records type.

No

types

An array of page types on which the user can add the block:

  • charts. The user can add the block to the chart group of a record list page.

  • dashboards. The user can add the block to a dashboard page.

  • homepages. The user can add the block to a homepage.

  • records. The user can add the block to a record details page.

Yes

when

A condition that determines when to show the block on the screen. For more information, see the coding reference.

No

Note: Blocks on pages of the charts, dashboards, and homepages types use the min_w, max_w, min_h, and max_h keys to set their minimum and maximum size on the dashlet grid. The values of these keys are in columns and rows. The user can't drag the block beyond the minimum or above the maximum width or height.

Blocks on pages of the records type have a standard width but a variable height that you set with the recommended_height key, in pixels. The recommended height becomes the default height of the block, although the user can set their own height value when they add the block to a record details page.

A block that can appear on multiple types of pages uses the applicable size keys according to its page. When the block is in a chart group, for example, it follows the column and row sizes and ignores the recommended height. When the block is on a record details page, it does the opposite.

About script.js for blocks

The JavaScript file for a block is the block's main script. Kizen runs the script when the block loads, including when the user refreshes or resizes the browser window or changes the filters on a dashboard page. The script sets the starting state of the block.

The script can use standard JavaScript, most web APIs available to Web Workers, and Kizen's runtime API. Because the script acts as the signed-in user, it can do whatever the user can do in Kizen, with the same permissions, and it knows the user's name and currently active business. For all page types except for homepages, it also knows details about the page on which the block appears, such as the record on a record details page or the values of the filters on a dashboard page. The script can read this information from properties of the this.args object, although the exact properties depend on the page type. See the following table for details.

this.args property
Contains
Page types

dateFilter

The dashboard's date range as start and end dates

dashboards

entityId

The ID of the specific record

records

objectId

The ID of the record object

charts, records

teamFilter

The values of the dashboard's team filters as set by the user

dashboards

Note: For more information on the this.args object, see the coding reference.

Keep in mind:

  • A block script controls only its own tile. It can show toasts and modals and navigate to other pages in Kizen, but it can't otherwise change the browser window outside the tile. It can, however, launch the event script of another block from the same app on the same page. See Run the event script of another block on the page below for more information.

  • A block script runs only while the page holding the block is open. Navigating to another page or closing Kizen entirely stops the script. For tasks that need to run on their own, use an agentic workflow code step instead.

  • A block script starts fresh each time the block loads. To carry values from previous runs, store them in the user’s configuration or as short-term session data. For details, see the coding reference.

  • A block script must finish before the user can interact with the block. Code that runs on a loop or long delay belongs in an event script.

Paint content into the block

To paint content into the block, use one of two methods: this.outputUI() or this.outputIframe().

For HTML and CSS, use this.outputUI():

The method takes a single HTML string as its argument. The CSS comes from the block's styles.css file or from inline style attributes in the HTML. For security, Kizen strips out <script> tags, event handlers, and javascript: links but leaves SVG, images, and <iframe> elements. For more information, see the coding reference.

To embed a live web page, use this.outputIframe():

Note: Another way to embed a live web page is to write an <iframe> element into your custom HTML with this.outputUI().

The page loads from its own server and runs its own code, so it can update itself. The address must start with https://, and the site must allow embedding. For more information, see the coding reference.

Note: Kizen loads embedded pages through a frame proxy at https://plugin-assets.kizen.com. If you need to update your site to make it embeddable in Kizen, allow the proxy's domain, not just Kizen's. For more information on the frame proxy, see the coding reference.

Run the event script of another block on the page

From the script.js file of the current block, you can launch the event script of an entirely different block using the this.communicate.runBlockScript() method:

Keep in mind:

  • The target block must belong to the same app as the current block. You can't target blocks that belong to different apps.

  • The target block must be on the same page as the current block. If it isn't, nothing happens.

  • If the target block appears more than once on the page, every instance runs the same event script. You can't target them individually.

For more information on this.communicate.runBlockScript(), see the coding reference.

About styles.css for blocks

The style sheet for a block provides the style definitions for the classes in the block's custom HTML:

You don't need a style sheet if your block uses this.outputIframe() to embed a live web page.

Note: Custom HTML content can inherit styling from Kizen before your style sheet applies. Therefore, for best results, explicitly set style properties for your classes instead of relying on default settings.


Add a block to a page

When a user installs your app, your app's blocks don't automatically appear in Kizen. The user must manually add them to the appropriate pages. Each block's types configuration key determines which types of pages it can appear on:

Type
Appears on

charts

Record list pages

dashboards

Dashboard pages

homepages

Homepages

records

Record details pages

Note: A block can belong to multiple page types.

After you add blocks from an app to pages in Kizen, uninstalling the app hides the blocks on record details pages but shows placeholder tiles on all other page types. Reinstalling the app returns the blocks to their placeholders.

For step-by-step instructions on adding blocks to each page type, keep reading.

Add a charts block to a record list page

To add a charts block to a record list page:

1

Go to the list of custom objects

From the global navigation, select Data > Custom Objects.

2

Go to the record list of a custom object

Select the name of a custom object in the list.

3

If necessary, switch to Chart view

Select the icon for Chart view at the top of the page (see Figure 3).

The user selects the Chart view icon at the top of the page to switch to Chart view.
Figure 3: The icon for Chart view.
4

Add the block

To add the block:

  1. Select Add Chart. The Add New Block modal appears (see Figure 4).

The user opens the Add New Block modal.
Figure 4: The Add New Block modal for the chart group on a record list page.
  1. Under Integrations, select the app with the block that you want to add. The controls on the modal change (see Figure 5).

When the user selects an app from the modal, the modal shows a dropdown menu for choosing a block and a slider for turning on a drop shadow.
Figure 5: The reconfigured Add New Block modal for the chart group on a record list page.
  1. From the dropdown menu, select the block to add.

  2. To display a subtle shadow under the block's tile, turn on the drop shadow effect.

  3. Select Add. The modal closes, and the block appears on the page.

  4. Drag the lower right corner of the block to adjust its size.

Add a dashboards block to a dashboard page

To add a dashboards block to a dashboard page:

1

Go to the Dashboard page

From the global navigation, select Dashboard.

2

If necessary, select a dashboard

Open the menu next to the name of the current dashboard, and select the dashboard on which you want to add the block (see Figure 6).

The user opens a menu to select a dashboard.
Figure 6: The dashboard selector.
3

Add the block

To add the block:

  1. Select Add Dashlet. The Add New Block modal appears (see Figure 7).

The user opens the Add New Block modal.
Figure 7: The Add New Block modal for the Dashboard page.
  1. Under Integrations, select the app that has the block that you want to add. The controls on the modal change (see Figure 8).

When the user selects an app from the modal, the modal shows a dropdown menu for choosing a block and a slider for turning on a drop shadow.
Figure 8: The reconfigured Add New Block modal for the Dashboard page.
  1. From the dropdown menu, select the block to add.

  2. To display a subtle shadow under the block's tile, turn on the drop shadow effect.

  3. Select Add. The modal closes, and the block appears on the page.

  4. Drag the lower right corner of the block to adjust its size.

Add a homepages block to a homepage

To add a homepages block to a homepage:

1

Go to the Homepages page

From the global navigation, select Homepages.

Note: If you don't find the Homepages link in the global navigation, add it to your toolbar layout. For instructions, see our knowledge base.

2

If necessary, select a homepage

Open the menu next to the name of the current homepage, and select the homepage on which you want to add the block (see Figure 9).

The user opens a menu to select a homepage.
Figure 9: The homepage selector.
3

Add the block

To add the block:

  1. Select Add Block. The Add New Block modal appears (see Figure 10).

The user opens the Add New Block modal.
Figure 10: The Add New Block modal for a homepage.
  1. Under Integrations, select the app that has the block that you want to add. The controls on the modal change (see Figure 11).

When the user selects an app from the modal, the modal shows a dropdown menu for choosing a block and a slider for turning on a drop shadow.
Figure 11: The reconfigured Add New Block modal for a homepage.
  1. From the dropdown menu, select the block to add.

  2. To display a subtle shadow under the block's tile, turn on the drop shadow effect.

  3. Select Add. The modal closes, and the block appears on the page.

  4. Drag the lower right corner of the block to adjust its size.

Add a records block to a record details page

To add a records block to a record details page:

1

Go to the list of custom objects

From the global navigation, select Data > Custom Objects.

2

Go to the record list of a custom object

Select the name of a custom object in the list.

3

Open the object settings

Select the Settings icon, and choose Object Settings from the menu that appears (see Figure 12). Kizen opens the editing interface for the custom object.

The user selects the Settings icon and chooses Object Settings from its menu.
Figure 12: The Settings icon and menu for the custom object.
4

Customize the record layout

To customize the record layout:

  1. Go to the Customize Layout step of the custom object editor (see Figure 13).

The user switches to the Customize Layout step of the object editor.
Figure 13: The Customize Layout step of the custom object editor.
  1. From the Choose Layout to Modify dropdown menu, select the layout on which to add the block.

  2. In the work area under Customize Record Layout, choose a column of the record details page into which to add the block, and select its Add Layout Component control (see Figure 14).

The user selects one of the the Add Layout Component controls in the Customize Record Layout work area.
Figure 14: One of the Add Layout Component controls in the Customize Record Layout work area.

Kizen opens the Add Layout Component modal (see Figure 15).

The user opens the Add Layout Component modal.
Figure 15: The Add Layout Component modal.
5

Add the block

To add the block:

  1. Under Integrations in the modal, select the app that has the block that you want to add. The controls on the modal change (see Figure 16).

The user selects an app under Integrations, and the controls on the modal change.
Figure 16: The reconfigured Add Layout Component modal.
  1. From the Choose Block dropdown menu, select the block to add. Kizen automatically sets its recommended height.

  2. Drag the Block Height slider to change the height of the block if you prefer.

  3. In the Internal Block Name field, type a name for the block. This name is how Kizen refers to the block in the Customize Record Layout work area.

  4. Select Save. The modal closes, and the block appears in the Customize Record Layout work area (see Figure 17).

The user finds the new block in the Customize Record Layout work area.
Figure 17: The block in the Customize Record Layout work area.
  1. Drag the block elsewhere in the work area to position it where you like among the other pieces of content on the record details page (see Figure 18).

The user moves the block to a different relative position in the Customize Record Layout work area.
Figure 18: The repositioned block in the Customize Record Layout work area.

Note: Use the mockup of the layout under Record Preview to help you position the block.

  1. Select Save at the top of the custom object editor.

Note: After you have placed the block on the record details page, you can edit its height and internal name by going back to the Customize Layout step of the object settings, opening the block's ellipsis menu in the Customize Record Layout work area, and selecting Edit. You can also change its position by dragging it elsewhere among the other pieces of content in the work area.


What's next?

Continue to Create Data Adornments to learn how to create data adornments for your app.


Last updated

Was this helpful?