Clear Sharepoint People Picker field

  • 13 July 2012
  • 8 replies
  • 47 views

Badge +3

Hi,


I have a process that needs to clear a Sharepoint People Picker field.
Filling it with a user name works fine but clearing it not.


Leaving the field empty in the Sharepoint List Item event doesn't work.
"Filling" it with the Empty String function doesn't work either.


Does anyone have an idea?


Thanks,
Lucien


8 replies

Badge

Did you find a solution for this?


Thanks,


Ben

Badge +3

No Ben, i didn't. I'm still hoping for an answer...........

Userlevel 2
Badge +9

I believe it is/was a known limitation that you cannot empty out SharePoint fields from within K2.


Have you tried using just a space?

Badge

Any solutions to this? I also tried an empty string, no value and a space, but all did not work to clear the People picker field.

Badge +6

Even I had simillar problem, and it is a known limitation. For K2 we cannot empty the PeoplePicker field .


The workaround I have applied is, add a text column in the sharepoint list and fill the column from K2. On SharePoint page load event add a code to check, if the text column contains value fill the PeoplePicker control, and if the value is empty don't fill PeoplePicker control.

Hope this help.

Thanks,
Aman

Badge +8

Had a look at this yesterday and it does seem feasible when using the CSOM broker. With SharePoint CSOM, it really just saves the user ID and I set the user ID to 0. You can use any arbitrary value you want as long as it does not resolve to a user ( I tested -1 as well). That way it does not resolve the user and the field is displayed as empty. However, the value 0 is persisted, so if you make use of this column in other places, ensure that you check for 0 and handle that as if it was an empty field.


Steps to get this going:



  1. Create a new Service Instance for your site, using the CSOM broker (installed as SharePoint Content)
  2. Create a SmartObject for the List
  3. Execute this SmartObject's Update List Item method when you want to clear this field, ensure that you set the ID and the User field (set to 0) in your process, using the SmartObject event
Badge +3

Yes i have tried using just a space. That doesn't work.

Badge +3

Thanks for the answer dc, I will try this.

Reply