General functions - isNil /coalesce - don't work as expected

I have a module “M” with 2 fields “F1” and “F2”, both are string data type.

Also, I have created an workflow (trigger - before insert) to check “F1” and “F2” values.
Inside workflow I used “isNil” function to check if for a specific field has been sent a value:

isNil(record.values.F1)

If for field “F1” I don’t mention any value and I try to save the record, the workflow
will fail → failed: expected type interface {} for parameter 0 but got

I have tried “coalesce” function too, like:

coalesce((record.values.F1, “”)

but, unfortunately, I have got the same message → failed: expected type interface {} for parameter 0 but got

Why is this behavior ?
How should I use “isNil” or “coalesce” functions ?

In my above post the error message hasn’t been saved appropriately.
The error message is → failed: expected type interface {} for parameter 0 but got “nil”

have you tried this

(record.values.F1?? false) ? F1_is_not_null : F1_is_null

1 Like

Hi @munawir

Thank you very much for your fast answer.
Yes, indeed “??” function solved my issue.

I opened this case since my expectations were that, at least, “isNil” function to work properly into the scenario described above.

1 Like

most welcome @CezarRadan

I don’t use isNil so @tjerman might have an answer for you here

1 Like

There were some problems with isNil and coalesce a while back and I thought those were already resolved – your snippets look ok.

We’ll take a look but in the meantime use the null coalescence operator (??) as suggested by munawir.

1 Like

There seems to be an issue with gval (what we use under the hood for expressions); please use the coalescence operator (?? ) until we resolve it.

Hey @CezarRadan
This is resolved now, It is available with latest release 2022.9.0.

1 Like