Workato · Formulas

Undefined method for nil:NilClass

Short answer

Undefined method for nil:NilClass means a formula ran on a datapill that had no value at runtime. Add the & safe navigation operator to the formula, for example [Datapill]&.capitalize, so it is skipped when the datapill is null.

VerifiedLast verified

01Error text

Workato error
Error calculating input for field 'company':
Formula received a nil value:
undefined method `capitalize' for nil:NilClass

02Likely causes

  • The value of the datapill is null at runtime.
  • A Get action returns records with missing fields.
  • A Search action returns no results.
  • A SQL query returns 0 rows.

03How to fix it

  1. Open the failed job and find the step and field named in the error, such as company in the example.
  2. Find the datapill used in that field's formula, and check the earlier step's output to confirm it was empty.
  3. Add the & safe navigation operator before the formula, for example [Datapill]&.capitalize. The formula is applied when the datapill has a value, and it is skipped and returns null when the datapill is null.
  4. Repeat the job to confirm the step now completes.

iNotes

The field name and the formula name in the message are your own. The text above is the example in the Workato documentation. The string formulas page adds that present?, presence and blank? do not raise an error on nil.

04Official documentation

Test every fix in a non-production environment before you apply it to production. See how entries are verified.

More for Workato work:Open Workato jobsWorkato rates and salariesHire a senior Workato developer

The iPaaS Brief

Subscribe to The iPaaS Brief.

The iPaaS newsletter for the people who run integrations. From iPaaS Group.

Free. You finish on theipaasbrief.com and confirm by email.