Nintex Workflow - Set a lookup column to null


Badge +5

I have a scenario where I want to set a lookup column to null from the workflow, as if the value was never selected.

Something equivalent to this PowerShell but in Nintex Workflow:

$item["ColumnName"] = $null

$item.update()

Thank you in advance happy.png


13 replies

Userlevel 5
Badge +14

setting value to zero should do the job

Badge +5

Thank you Marian, but I actually tried this before posting the question and it is not working as 0 is not a valid value for a lookup and it gives an error when you open the form (The same as this one: https://community.nintex.com/message/45513?et=watches.email.thread#comment-45513)

Userlevel 5
Badge +14

then that might be as well some bug introduced with recent release(s).

it works in my env, but I'm not on the most recent release yet.

if you try to write value of lookup column which haven't had set any value yet to history log, does it provide some output/value?

Badge +5

The workflow show nothing (empty string) in the log when logging the unselected lookup the same when logging the deleted lookup. But using PowerShell it will show you the saved value if it is deleted.

Userlevel 5
Badge +14

one more idea - let's try to create workflow variable of type 'List item ID' and try to assign it to a list column that you want to clear.

Badge +5

Marian, keep thinking (Y)

I actually tried this one as well yesterday and it gives an error "Coercion Failed: Unable to transform the input lookup data into the requested type."

Badge +5

By the way this is working for columns of type person.

Userlevel 5
Badge +14

what about to try to feed it with ";#"  or "0;#" ?

Badge +5

- Set it to empty string variable:

Workflow error: Coercion Failed: Unable to transform the input lookup data into the requested type.

- Set it to empty lookup ID variable:

Passed workflow, error on form: One or more field types are not installed properly. Go to the list settings page to delete these fields.

- Set it to empty lookup ID variable (with Return Type: Item Id):

Passed workflow, error on form: One or more field types are not installed properly. Go to the list settings page to delete these fields.

- Set it to a string variable with ;# as a value

Workflow error: Coercion Failed: Unable to transform the input lookup data into the requested type.

- Set it to a string variable with 0;# as a value

Passed Workflow, error on form: An unexpected error has occurred. (the same as https://community.nintex.com/message/45513?et=watches.email.thread#comment-45513)

- Set it to a number variable with 0 as a value

Passed Workflow, error on form: An unexpected error has occurred. (the same as https://community.nintex.com/message/45513?et=watches.email.thread#comment-45513)

- Set it to a number variable with -1 as a value

Passed workflow, error on form: One or more field types are not installed properly. Go to the list settings page to delete these fields.

- Set it to a person variable:

Workflow error: Coercion Failed: Unable to transform the input lookup data into the requested type.

- Set it to a List Lookup to the lookup list with a condition that should return nothing:

Passed Workflow, error on form: An unexpected error has occurred. (the same as https://community.nintex.com/message/45513?et=watches.email.thread#comment-45513)

- Set it to a List Lookup to the column itself (which is logging empty string in the history):

Passed Workflow, error on form: An unexpected error has occurred. (the same as https://community.nintex.com/message/45513?et=watches.email.thread#comment-45513)

Userlevel 5
Badge +14

nice workout.

it seems the functionality is really broken an the best would to involve nintex support into that just like for the other thread.

Badge +5

Right now they are working on fixing it, we have an opened ticket for this issue (https://community.nintex.com/message/45513?et=watches.email.thread#comment-45513) and once fixed it will make setting to null easier, as any of the above options will be a valid option.

Badge +3

Tested with "Update item" action or "Set field value" action in NWF with zero ("0") and they both worked.

Badge +2

For anyone else where this still isn't working, @vmanning gives the solution in this post . I have copied below for your convenience.

Regards

"For those who are still having issues with this, I tried the solutions mentioned above and it wasn't working for me. Then I realised that the lookup field that I was using was enforcing relationship behavior (cascade delete), that was why I couldn't set it's value to null. Luckily it was a case where I could disable the relationship and it all worked fine after that."

Reply