Set a date back to an empty value in a workflow

I have a workflow that sets a date to today’s date for a set of records.

I want to create an analogous “undo” workflow which clears the date, but I haven’t been able to get a workflow to do that. Is this not currently possible?

I’ve tried setting the date to an empty value and get an error. I’ve also tried the omit function to exclude the date field, but I got an error by doing thtat as well.

Hi Shmuel,

I trust you are well.
I have yet to have tested this myself but potentially setting the field to false might work.
IE - record.values.myDate ?? false : true OR potentially using Nil as described in the forum link

Kind regards

Setting it to false or "", 0, or nil gives me an error:

Could not update record: failed to complete transaction: cannot update data entry: pq: invalid input syntax for type timestamp: “”

Is there any way around this?

Have you tried to set the value to undefined?

@katrinyordanova, undefined is not a built-in variable. As mentioned above, I’ve tried setting it to false , "" , 0 , and nil none of which worked. The way I set it to nil was by defining a variable without setting its value.

Hello everyone,

Did anyone find a nice solution for this ?

I ended up by adding a datetime field that is always empty and to empty a datetime field, I just do fieldToEmpty = alwaysEmptyField and it worked :sweat_smile:

Hi @KOAMSK

I think the solution suggested by @shmuel is a little neater than creating another field that is empty … the workflow expression would simply have a variable name (e.g. blankDate) with no value, and then that variable with no value is posted to the date field you want to clear.

2 Likes

Hi everyone,
That is true ! It didn’t work the first time but now it works like a charm !
I had to define variable called empty (type: any) = (an empty field) and set column.value (type:any) = empty

When I changed from any to datetime I had an error.

1 Like

I am having a weird consequence when I updated to 2023.9.1 :
When I empty the dates, they appears like “01-01-0001”. Did anyone of you guys experience this ?

Cheers

@KOAMSK Hey, from which version to which version did you upgrade?
Any other things that changed?
Also what database are you using? Any other relevant data is useful aswell.

Hey !
It is the version 2023.9.1 and the update was from version 2023.3.2 (I’m not sure about the subversion).
Here is the export of a simple module and a workflow to replicate the error empty date 2023.9.zip (1.7 KB)

Before :


After :

1 Like

Did anyone encounter this problem ? Was this resolved ?

I suggest you open a separate issue so it doesn’t get buried.
@tjerman wanna take a look at this?

1 Like