1

The Question
Is there a way, either through a hack or an action I haven't noticed, to clear the value in a specific field of an item, using a workflow?


The Issue
All I want to do is clear the values in my Archived Date and Archived By fields (see The Setup,) but I can't find a Clear Field in Current Item action, and I can't leave the Value blank in a Set Field In Current Item action.



For More Information:
The Setup
I am building my workflow in SP Designer

I have a document library, and I want to be able to Archive documents, rather than delete them. To this end I have added an extra value to the Status lookup I already have in place; Archived.

I have then set up a workflow that adds some data to the record to track who archived it, and when. I have the following fields:

  • Archived Date [Date Content Type]
  • Archived By [Person/Group Lookup Content Type]
  • Archived Data Updated [Yes/No Content Type]

The Archived Data Updated field is used by the workflow to detect whether or not a document updated with the Status set to Archived has already had these values recorded; to stop it from overwriting.


The Requirement
So I want to enable users to "unarchive" a document, returning it to Live status. And when this happens I want to clear the Archived Data fields, and set the Archived Data Updated field back to No.

I have the logic laid out: Workflow Logic

2
  • Are you creating this in Designer or via code? If it's the latter, there's a pretty quick and easy way to do it. Then again, if it's the latter, you're writing code. Jul 30, 2013 at 16:11
  • In Designer @JohnCraven, I don't have access to Visual Studio
    – CLockeWork
    Jul 31, 2013 at 9:39

1 Answer 1

4

If you are using the Designer, you can use the Action "Update List Item" and set your Archived By to nothing (see below). As for clearing the Archive Date, I set up a DateTime column that has a default value of "(None)". You can have that in another list (I put it in a list called "test", which has only one item). Then you can use that to clear the date from your Archive Date (as I did in the screen capture).

enter image description here

9
  • Thanks Frank, I don't supose there's a smoother way to do the date? I'm leaving soon and would rather not have such a complex solution in place. Also, for the set user to nothing bit; I can't access that link in work, but I'm assuming you mean enter the value "" in the Value field? That works fine for me :)
    – CLockeWork
    Jul 31, 2013 at 9:53
  • Hi @CLockeWork, you can leave the Archive Date blank, which sets it to '1900/01/01', although I find that displaying the date as 01/01/1900 in views not elegant. You can conditionally format/display if blank or 1900/01/01. Aug 4, 2013 at 2:16
  • Thanks for your help @Frank, and sorry to keep coming back on this; I can't see a way leave the Archive Date blank, if I add no value then the workflow returns an error.
    – CLockeWork
    Aug 5, 2013 at 8:31
  • 1
    Try creating a workflow variable, leave it uninitialised and use it in the Value. Aug 5, 2013 at 11:51
  • 1
    These techniques are not working for me at all... I've tried everything: setting value to a pre-existing blank date field, setting value to a blank date field in another list, setting value to a blank string, setting value to 01/01/0001. It will either disallow my input or throw an "invalid date" exception. I am using SharePoint Workflow 2013 in SPD2013. Thanks.
    – Aaronster
    Aug 8, 2014 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.