It occurred to me that we might be able to change the type of the field to a string and then be able to perform the comparison. I used the "Build Dynamic String" action.
I selected the End Date custom field on my Expense Statements list and stored it in a new variable that was typed as STRING.
The results of this were not exactly what I expected, however I was able to determine, through trial and error (sending the values in an email), that the conversion created a string that was filled with question marks (????). Therefore, if you simply test to see if the new string begins with a ?, you can successfully test for an empty date value.
Both my student and I were happy with the results. There may be other ways to do this (perhaps by testing if the value of the date is equal to the "beginning of time" date), but this certainly seems like an easy and foolproof method.











5 comments:
I ran into a similar issue with date fields and numeric values (the same rules seem to apply for numerics). I ended up creating workflow string variables and setting the values of those string variables to the values (or lack thereof) of my numeric & date fields. Then I could test to see if those fields were empty b/c they were strings.
I used a similar solution which I gleaned from somewhere on the 'net. I created a string workflow variable, set it's value to the value of the date field, and then checked the string variable for empty. Worked like a charm.
Now I'd like to find a way to set a non-required date field to empty in a workflow.
thanks for this! this worked to help me with a similar situation. Needed to test for Null date in my workflow, had three dates for followup emails, followup 1 is required and followups 2 and 3 are not required. I needed a way to stop the WF from running and your post shed light and helped!
Very helpful, thanks! Sharepoint is 40% skill, 60% bodging I find.
Hi,
I have a list which has a start date columns. During the ItemDeleting event i need to check whether the start date is empty or not.
I tried checking like
if (contextItem["Start Date"].ToString() != string.Empty)
// current_StartDate = (DateTime)contextItem["Start Date"];
But it doesnt seem to work :(
Could anyone please help me with this?
Post a Comment