Docs
On this page
task2 min readApplication: SOFI Core

Show Sofi suggestions on a form

Add a UI event that starts Sofi on a table's form, so agents see classification, knowledge and action suggestions as they type.

Add Sofi to a form when a table has a classifier but its form shows no Sofi suggestions. The shipped tables, such as Incident, Change and HR case, already have this UI event. This page is for administrators who write UI events.

Before you begin

  • You need the administrator role and the rights to edit UI events.
  • A classifier must exist for the table. See Create a classifier.
  • Note the classifier names to call: the classification classifier, and if you want them the knowledge and action classifiers, such as Knowledge and an ActionResult… classifier.

Steps

  1. Go to Administration → Business Logic → UI event. Open a shipped event such as “Incident - Enable sofi on form load” to use as a model.

  2. Select New. Enter a Name such as “My table - Enable sofi on form load”, set Table to your table, Event type to the form event type and Event name to onLoad.

  3. Enter the script. It registers Sofi on the main form view and runs the classifiers whenever the trigger field changes.

    if (formContext == "detail.main") {
        include(["SofiClient", "SofiActivityLogger"], function (SofiClient, SofiActivityLogger) {
            var triggerField = "ShortDescription";
    
            function runSofi(searchText, options) {
                if (!searchText) {
                    activityLogger.clearLogActivity();
                }
                client.classify(searchText, "MyClassifier", options);
                client.knowledgeSearch(searchText, "Knowledge");
            }
    
            let client = SofiClient.registerFormInstance(_formInstance, current);
            let activityLogger = SofiActivityLogger.setup(client, _formInstance, current, "WorkJournal", triggerField);
    
            client.onFieldEvent(triggerField, "*", function (event) {
                activityLogger.setTriggerFieldChanged(true);
                runSofi(event.newValue);
            });
    
            setTimeout(() => {
                if (current.getField(triggerField).hasValue()) {
                    runSofi(current.getField(triggerField).getValue(), { force: true });
                }
            }, 1000);
        });
    }
    
  4. Replace MyClassifier with your classifier’s name, and ShortDescription with the field the classifier reads. To rank intelligent actions too, add client.actionSearch(searchText, "<action classifier>", options); and the client.onExecuteIntelligentAction handler from the shipped event.

  5. Select Active and save.

Result

When an agent types in the trigger field, the Sofi panel shows suggestions in its Sofi Smart Classification tab. Knowledge appears in Sofi Smart Search. Sofi notes what it found in the work journal. The classifier’s UI context decides whether values are filled in automatically.

Last updated 24 November 2026commit 88e011e506a8Chris Jones
Back to top