Tool Call link_workitem

Searches for workitems with the same mechanism as find_workitem and links every match directly to the current case (up to 10).

Search and link happen in one step on the server. The agent never has to copy an identifier by hand, so there is no risk of a transcription mistake.

See Tool Calls for the general concept.

When to use

Use link_workitem whenever the goal is to actually create the link - the same as a person would do with the “link workitem” component in a form. If the agent should only look at cases, use find_workitem.

Arguments

Argument Required Description
criteria yes Field name/value pairs to search for, combined with AND
filter no Additional condition for special cases. Pass through exactly as given in the prompt
refField no Field to store the link in additionally. The link is always stored in $workitemref as well

How to write criteria, filter and <item>itemname</item> is described in Selecting Workitems.

What happens

  • Every match is added to the reference field $workitemref and, if given, to refField. Existing links are kept and a case is never linked twice.
  • At most 10 matches are linked per call.
  • A reference field can hold several links. A manager can review and correct the list later in the form.

What the agent gets back

The agent receives the number of linked cases (linkedCount) and the matched cases with their summary. Your prompt can tell the agent exactly how to react to zero, one or several matches.

Prompt example

After writing the fine data, use the tool call "link_workitem" to search for the matching
leasing contract and link it to the current workitem in one step. Pass the extracted plate
number (fine.plate.number) as the value for the index field "id", and the fixed value
"Contract" for the index field "$workflowgroup" inside the criteria parameter. Also pass
"contract.ref" as the refField parameter, so the link is additionally stored in that field.
Example: {"criteria": {"id": "M-AH-4524", "$workflowgroup": "Contract"}, "refField":
"contract.ref"}

If link_workitem reports exactly one linked match (linkedCount: 1), call task_complete with
a short one-sentence summary. If it reports zero or more than one match, do not call
task_complete - respond with a short plain-text note instead, stating how many contracts
were found and that a manager needs to review the case.

Tips

  • Use <item>itemname</item> for values that already exist on the current case, e.g. <item>$uniqueid</item>.
  • Decide in advance what a “wrong” result looks like (none or too many) and send those cases to a person.