How to make a date property/field required

Hello Experts,

I have added 2 new custom properties to my extended incident class via xml editing. One of the fields is a "datetime" property and is required to be filled out. As such, I must state the default value of the required property.... However, the default value would probably be system time, as there is no "default" value for such a variable property.

Any ideas how to mark a datetime field as required without listing a default or how to set the default to the current system time?

I tried setting the default value as NULL but it complains I need to use a value that can be converted to type System.DateTime so it must be reading it as a string....

Thanks in advance!

UPDATE: So I tried entering a manual date in the DefaultValue paramater (although this is not desired behavior). I get no errors on seal or bundle but when I import i get an error:

The management pack import failed. 
Errors (1):
Database error. {0} failed with exception: 
{1}
: Database error. MPInfra_p_ManagementPackInstall failed with exception: 
[MP ID: ef0406bc-7732-a8bd-ff53-a46599431223][MP Version: 1.0.0.39][MP PKT: 2fb7047900162a4c]  Database error. MPInfra_p_ManagementPackInstall failed with exception: 
Conversion failed when converting date and/or time from character string.
The statement has been terminated.

I entered the property like this:

<Property ID="Called_Logged_On" Type="datetime" AutoIncrement="false" Key="false" CaseSensitive="false" MaxLength="256" MinLength="0" Required="true" Scale="0" DefaultValue="Wednesday, April 1, 2015 12:00:00 AM" />

  • Edited by SirLearnAlot Tuesday, September 01, 2015 4:05 PM
August 31st, 2015 5:18pm

anyone?
Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 9:28am

There is a much easier way to do this by xml. I did not want to re-code the entire form... I actually ended up discovering this on my own by reversing some of Microsoft's stuff. You have to set the following on a date time property in your MP xml to make it required AND as a bonus pull the current system date and time:

Required="True" DefaultValue="GetUTCDate()"


September 9th, 2015 10:09am

There is a much easier way to do this by xml. I did not want to re-code the entire form... I actually ended up discovering this on my own by reversing some of Microsoft's stuff. You have to set the following on a date time property in your MP xml to make it required AND as a bonus pull the current system date and time:

Required="True" DefaultValue="GetUTCDate()"


  • Marked as answer by SirLearnAlot Wednesday, September 09, 2015 2:07 PM
Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 2:07pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics