Solved

How to set a person or group field to empty in Nintex Workflow

  • 29 December 2015
  • 24 replies
  • 657 views

Badge +3

Hi,

 

I cant get this to work properly. I have a person or group field on a list and at the end of the workflow, I want to clear the field. I'm using the 'Set Field in Current Item' action currently to set the field to a blank variable. This seems to only partially remove the user entity from the field though as the edit form is broken for the specific item when the workflow has ran. I can also see on the display form that the field still contains some information. Any help on how to do this would be appreciated.

 

Thanks

icon

Best answer by praveen_thallur 11 October 2017, 04:53

View original

24 replies

Userlevel 7
Badge +17

Try setting it to the value of a space character. Just hit the space bar once within the set field action. Let me know if you still have issues.

Badge +3

Thanks - just tested this though and get an error on publishing the workflow. I've confirmed that it doesn't like setting the value as a space within the set field action by testing with only that action in the workflow.

"Error publishing workflow. Workflow XAML failed validation due to the following errors: The private implementation of activity '1: DynamicActivity' has the following validation error: Value for a required activity argument 'Operand' was not supplied. HTTP headers received from the server - ActivityId: 34d64f90-d825-44cd-abee-421efb244424. NodeId: . Scope: . Client ActivityId : cf09509d-6069-2000-0d0b-d7f608582633. The remote server returned an error: (400) Bad Request."

Userlevel 7
Badge +17

yes, the validation doesn't seem to understand how to save this or that it knows this is invalid. Save a space value into a Single Line of Text variable and use its value to set the Person field.

Badge +3

Thanks, but surprisingly I still get the same error when publishing if I use a variable with space in it. I'll work around this for now by not using a person or group field, but think Nintex need to add a simpler way of doing this! 

Userlevel 7
Badge +17

So I did some searching and found that this is a very common occurrence for SharePoint 2010 and 2013 workflows for this field type. That is why Nintex is also affected. One solution was to create a Single Line of Text string as an initiation variable and not set it's default value and not provide one when the workflow starts. Then use this workflow variable as a null string throughout the workflow.

I tried this in my online tenant and I was now able to publish the workflow, but the process didn't seem to work. It may on premise, can you try this? Also, if this is the case, I wonder if turning of validation then running the workflow is all that is needed.

Badge +3

Yes, that may be the case. Unfortunately though, I don't have access to an on premise environment to check. It looks like there is currently no way to do this with NWF online.

Thanks for looking in to it Andrew.

Userlevel 7
Badge +17

Don't give up. We haven't tried everything i'm sure.

Badge +3

Hi,

I tried this previously, but couldn't get it to work. Is your workflow for the 365 version of NW? If I create a variable of person type, it forces it to be a initialization variable and requires the user to enter the value before the workflow runs. If I use an action to set it to blank, the workflow runs, but I seem to get the same problem of the field not being fully cleared. It may be something to do with the way I'm configuring it!

Userlevel 7
Badge +17

It may be that O365 just wont let it be set to null and you can on prem.

Userlevel 3
Badge +9

FYI, using the Update List Item action, I am clearing people fields.

In my scenario (O365), I have a process where I lookup the manager and manager's manager for an employee.

Unfortunately due to some silly stuff in our HR department, occasionally the manager and manager's manager are blank, and once I query it using call HTTP web service, I set the resulting value to a variable (Manager1 and Manager2), then use the update list item to set it.

If it is blank, it successfully updates the Managers name field to blank

Userlevel 7
Badge +17

Awesome thanks Brent!, Matthew Reaveley, have you tried this out?

Badge +8

Hello,

I had the same issue.

The following worked for me.

Set a workflow variable (Type Collection), with the User-/Group-Column which should set to null / empty

Use the "Clear Collection" Action, to remove all entries from the workflow variable

Use the "Update List Item" Action, to set the Column with the empty workflow variable

Userlevel 7
Badge +17

Matthew Reaveley​, do any of these answers provide a solution for you?

Badge +3

Thanks for the responses. I've moved on from this now, but tested Oliver's answer and still got the same result.

The item before the workflow runs:

The workflow:

After:

When trying to edit this item:

Userlevel 7
Badge +17

Ok thanks for feedback. It's good to know that it does clear the value, but seems to cause another issue.

Badge +8

Hey Matthew,

have you tried it on another site collection?

And gave it the same result?

Regards

Oliver

Badge +3

This worked for me in O365. Thx!

Userlevel 7
Badge +17

Hi! Just pinging to find out whether you found a solution or still looking for it? If yes (if you found) - can you write here how you achieve that? 

I'm doing it this way:

  1. I'm declaring the "People" variable under the "Variables", but then in workflow, I'm not assigning any value to it.
  2. Then I'm just using this only-declared variable for comparison and... it works. This variable, when logged to history, seems empty.

 

Regards,

Tomasz

Badge +1

This might work.

1. Define a workflow variable of type Person or group and leave default value as empty.

2. Use this variable as a value to set a list item user column or another workflow variable.

Badge +5

Hi Tomasz,

Was your "People" variable a text variable or a Person/Group variable?

I tried first with a Person/Group variable (in a site workflow), but when selecting that variable type it was automatically set as an initiation parameter (appears on start form) and I could not change that.

When I used a text variable, the workflow did not report any error, but the person column (multi-select) was not set to null...it just kept the values that were already in the column.

Cheers,

Barry

This solution not work for me in this time (2020).


However, I found another solution, it is just set the field value as "[]" (no need double qoute)


It mean set the field as a empty array.

Just encountered this same issue today (Nintex for Office workflow) and can affirm that GP's solution of setting field equal to [] worked like a charm after attempting the null person setting. @GP 

Hello! I've tried all the solutions mentioned here but none of them seem to be working as intended. At least not completely. 

While setting a person field with a value of [] or using Update List Item without entering anything in the value area does make the field appear to be blank, it isn't. When I try to update the list item, this is what appears in the person field



It displays blank but if you update the item afterward, you get an error and need to manually delete that null entry from the person field.


 


 

This works perfectly in my Nintex O365 workflow environment. Thank you so much.
Not sure why Nintex does not add those in the action documentation so it does not drive so many people insane.
Again, thank you!

Reply