Skip to main content
Nintex Community Menu Bar

Nintex Workflow - Set a lookup column to null

  • August 16, 2016
  • 13 replies
  • 59 views

Forum|alt.badge.img+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

Forum|alt.badge.img+14
  • Scholar
  • August 16, 2016

setting value to zero should do the job


Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • August 17, 2016

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)


Forum|alt.badge.img+14
  • Scholar
  • August 17, 2016

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?


Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • August 17, 2016

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.


Forum|alt.badge.img+14
  • Scholar
  • August 17, 2016

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.


Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • August 17, 2016

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."


Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • August 17, 2016

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


Forum|alt.badge.img+14
  • Scholar
  • August 17, 2016

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


Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • August 17, 2016

- 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)


Forum|alt.badge.img+14
  • Scholar
  • August 17, 2016

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.


Forum|alt.badge.img+5
  • Author
  • Nintex Partner
  • August 29, 2016

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.


Forum|alt.badge.img+3
  • August 3, 2018

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


Forum|alt.badge.img+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."