Keyform StudioHelpOpen Keyform Studio

Training Guide: Optimizer

This guide shows you how to grade a Unity Script from OnBase Studio, read what it found, and use the suggested rewrite. Allow about 30 minutes. You don't need an OnBase connection: you paste the code, and the review runs in your browser.

Chapter 1: What the Optimizer does

You paste the C# of a Unity Script and the Optimizer gives you three things:

You getWhat it is
A gradeA to F with a score out of 100, like a school grade, for how well the script is built
FindingsEach problem with its line number, why it matters and how to fix it
A rewriteThe script with safe fixes applied, shown as a diff, plus an optional full rewrite by an AI model

What it reads

It recognizes Workflow, WorkView, Unity Form, scheduled task and event scripts from the interface the class implements. If the code isn't a Unity Script, it says so and grades it anyway.

What it can't do

Privacy

The review runs in your browser and sends nothing. Only the optional AI rewrite sends code, and only to the provider chosen in Settings: Anthropic with your own key, Microsoft 365 Copilot, or your company's editor back end. If the script contains a password, the button asks you to confirm first.

Chapter 2: Find your way around

Open the Optimizer tab. It has the same three-part layout as the other tabs.

AreaWhat's there
LeftSaved reviews, with New review. Below them, Try an example: a messy, an average and a well-built script.
MiddlePaste a Unity Script: a name and the code. Below it, the findings, worst first.
RightThe grade and score, the score for each area, the Rewrite with its diff, and Copy rewritten code, Use as my code and Download report.

The review updates as you type or paste. Reviews save with your other work.

Chapter 3: Review your first script

  1. Under Try an example, select Messy invoice approval.
  2. Look at the grade: F, 19 out of 100.
  3. Read the first finding, Password or secret in the code. It's critical, costs 20 points, and caps the grade at D whatever the score.
  4. Select Line 16 on the finding. The line is selected in the code so you can see it.
  5. Try Average vendor update (a C) and Well-built address cleanup (an A) to see the difference.

Review your own script

  1. In OnBase Studio, open the Unity Script, select all of its code and copy it.
  2. In the Optimizer, select New review, give it a name, and paste the code.
  3. Read the grade and findings.

Chapter 4: How the grade works

Every script starts at 100 and loses points for each finding, within five areas:

AreaPointsWhat it covers
Safety and correctness30Secrets in code, changing OnBase tables with SQL, SQL injection, locks never released, keyword changes never saved, missing null checks
Unity API use25Its own OnBase connection, direct database reads, repeated lookups, saving inside loops, huge query limits
Error handling and logging15Empty catch blocks, hidden errors, no try/catch, rethrows that lose the stack trace, no Diagnostics Console logging
Performance15Lookups inside loops, Thread.Sleep, building text in loops, forced garbage collection
Maintainability15Hard-coded IDs, paths and email addresses, message boxes, long methods, deep nesting, no header, commented-out code

An area never goes below zero. A finding that appears on several lines costs more, up to twice its points.

Grades

GradeScore
A90 to 100
B80 to 89
C70 to 79
D60 to 69
FBelow 60

Some problems cap the grade whatever the score:

Severities

SeverityMeaning
CriticalCan expose secrets or damage data. Fix before using the script.
HighLikely to fail, lock documents or lose changes.
MediumWorks, but fragile or slow.
LowTidiness and good habits.
NoteInformation only; costs no points, such as a Workflow script that never sets a result.

Chapter 5: Use the rewrite

The Rewrite shows Safe fixes by default. These only change how the script reports and tidies itself, never what it does:

The pill beside Rewrite, such as C 75 → C 77, shows the grade after the fixes. Still to fix by hand lists what's left: anything that changes behavior, such as moving a lookup out of a loop, is for you to decide.

  1. Read the diff: green lines are added, red lines removed.
  2. Select Copy rewritten code and paste it into OnBase Studio, or Use as my code to review it again here.
  3. Compile and test it in a Test system.

Full rewrite with AI

Select Full rewrite (AI) to have a model restructure the code, such as moving lookups out of loops. It needs an AI model chosen in Settings › AI assistant: Claude with your own API key, Microsoft 365 Copilot with your work account, or a model through your company's editor back end. With the offline assistant, only the safe fixes are available. If the script contains a password, the button asks you to confirm before sending it.

Chapter 6: Share the review

Select Download report to save the review as a web page. It holds the grade, the score for each area, every finding with why it matters and how to fix it, the suggested changes and the rewritten code. Passwords and secrets are masked. Open it in a browser and print to PDF for a code review or change control record.

Chapter 7: Practice

  1. Open Average vendor update. Fix Lookups inside a loop by hand: move KeywordTypes.Find("Vendor Number") above the foreach and reuse the variable you already have. Watch the Performance score rise.
  2. Open Messy invoice approval and select Use as my code. Which findings remain, and why couldn't the safe fixes change them?
  3. Paste one of your own scripts. Before reading the findings, guess its grade.

Troubleshooting

ProblemFix
"This doesn't look like a Unity Script"Paste the whole file, including the class line with its interface, such as : IWorkflowScript.
A finding doesn't apply to my scriptThe checks are patterns. Read why it matters and decide; a note in the script's header explaining the choice helps the next reviewer.
The safe fixes didn't add try/catchThey only add it when the script has no try at all and its main method receives the Application object.
Full rewrite (AI) says it needs a modelChoose a provider in Settings › AI assistant, such as Claude with your own API key, or use the safe fixes.
The grade seems harshEach finding shows exactly what it cost. Critical problems cap the grade on purpose.