Andi gives you the ability to target the print menu via field tags in PrecisionLender, which also allows you to generate custom printouts. This article will cover the print menu field tag template.


Print Menu Field Tags

The print menu in PrecisionLender can be targeted by field tags. Field tags on the print menu work a little differently than those that target inputs and dropdowns. Print menu field tags appear directly in the print menu as options when the Print button is clicked. Standard field tag features, such as the tick, the option to dismiss, and read/unread states do not appear on print menu field tags.

When a field tag is added to the print menu, the print menu will be converted into a tree structure. A header "Standard Printouts" will appear above the existing menu options, and the field tags will appear above those.

The print menu can be targeted by sending a field tag to the customPrint property in the printMenu container:

import { EventPowers, TagPowers, FieldTag, FieldTagTypes } from "@andi/powers";
export async function run(skillContext: ISkillContext): Promise<ISkillActivity> {

const tag: FieldTag = {
key: "victor-print-menu-test",
fields: [
container: "printMenu",
property: "customPrint"
section: {
name: "myReports",
headerText: "My Reports"
text: "My Custom Printout",
onClick: [
name: "sendSkillCallback",
args: [skillContext.skillMetadata.id]
tagType: FieldTagTypes.Info




Callback Events

Notice the sendSkillCallback default context command on the field tag in the code block above. When the field tag is clicked, it makes use of the new context command to send an event back to the skill that invokes a callback. This can be handled by the skill as follows:

function generateReport(): Promise<PrintProcessResponse> {
// generates a report and returns a fileId

if (EventPowers.isCallbackEvent()) {
const { fileId } = await generateReport();
const summaryTag: SummaryTag = {
text: "Report Generated",
tagType: FieldTagTypes.Info,
key: "templateReport",
onLoad: [
name: "printConversationFileAttachment",
args: [fileId]

return TagPowers.sendTags([summaryTag]);

For more information on generating a report file, see the Andi print documentation. When this code runs, a report file will be generated as a file attachment. You can use the new printConversationFileAttachment default context command to tell Andify to open that report file in a new tab and print the document.

To learn how to extend the sendSkillCallback command, check out this article

Was this article helpful?
0 out of 0 found this helpful