FIM Portal 2010 R2: Input DateTime control using JavaScript


For AD account created for new contractors, I want to specify the Expiration date of the account or the date the contract is expected to end. I am using the ExpirationTime field in the FIM portal. I do not want the date to be greater than 1 year from today, I don’t want manager specifying contract will end in 2 years etc because contracts are no more than 1 year maximum.

Desired solution

We want a control to check the Expiration date entered and compare it with one 1 year from today to determine if it exceeds it. if it does send a warning to the requester and erase the entry.

Here is the Javascript/Jquery code (I am using a combination)

function CheckContractExpirationDate() {
$(“#ctl00_PlaceHolderMain_CreatePerson_uoc_BasicInfo_grouping_ExpirationTime_control_internalDateTimeEditor”).change(function () {
var dNow = new Date();
var yearMax = dNow.getFullYear() + 1
var utcdate = new Date((dNow.getMonth() + 1) + ‘/’ + dNow.getDate() + ‘/’ + yearMax);
//check if the date entered is greater than one year from Today
var expT = new Date($(“#ctl00_PlaceHolderMain_CreatePerson_uoc_BasicInfo_grouping_ExpirationTime_control_internalDateTimeEditor”).val());
if (expT > utcdate) {
alert(“Contract End Date should not be greater than 1 year from Today. Please Re-Enter”);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s