Setting a date in a WF using the Function Evaluator
How would you, for example, set EmployeeStartDate to "Today", and EmployeeEndDate to "Today + 6 months" in a workflow?I tried to do something using the CreatedTime attribute but I didn't get very far...http://www.wapshere.com/missmiis
December 11th, 2009 5:34pm

Hi Carol,CreatedTime is stamped by system when resource is created. This cannot be manipulated.To acheive what you are trying to do, custom activity using UpdateResourceActivity can be used.Thanks,Sri
Free Windows Admin Tool Kit Click here and download it now
December 11th, 2009 10:09pm

I'm not trying todo anything toCreatedTime - I'm trying to set EmployeeStartDate. So how do I do that exactly? http://www.wapshere.com/missmiis
December 12th, 2009 12:04am

Hi Carol, I think that the answer is simply that you can't (unless you write a custom activity, of course). The "now" date function is one of the requests listed in the connect feedback "Feature Request: Custom Synch Rule Functions ". Cheers, PaoloPaolo Tedesco - http://cern.ch/idm
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2009 3:30pm

Caro,This is not possible by default as there is no activity to add a certain amount of time to an existing date. You would need to build you own activity that does this for you. I would such functionality to be default in FIM, but unfortunately the opposite is true. I have submitted a feature request to add more functions to all kinds of stuff (as Henrik has too)http://blogs.dirteam.com/blogs/jorge/archive/2009/10/19/additional-functions-needed-for-fim-2010.aspxcheers,Jorge de Almeida Pinto [MVP-DS / AD DS TechNet Forums Moderator] [Sr. Technical Consultant @ Oxford Computer Group] (http://blogs.dirteam.com/blogs/jorge/default.aspx) (http://www.oxfordcomputergroup.com/)
December 14th, 2009 10:47pm

Carol,To compound your problems (sorry), I have found a bug that won't even allow you to update a date-time field using a custom activity.You can even re-pro this using the Function Evaluator: 1. create a FE in an action workflow to copy EmployeeStartDate to EmployeeEndDate2. add a start date to a user3. create an MPR to fire the activity triggered on an update to first name (or whatever)4. edit the user's first name5. you will find an unhelpful PostProcessing error in the requestsIf you use a custom activity to do the same, you get a bit more information. The error says you cannot insert NULL into a datatime field.Steve Mitchell Technical Director - Oxford Computer Group
Free Windows Admin Tool Kit Click here and download it now
December 15th, 2009 1:18pm

Thanks for all the reponses guys. I hope this is available in RTM as it seems like the sort of thing a lot of people will want to do.Carolhttp://www.wapshere.com/missmiis
December 15th, 2009 3:05pm

I just wrote a workflow for a customer to do this without any probelms... It's not a big deal... EricEric
Free Windows Admin Tool Kit Click here and download it now
December 15th, 2009 8:14pm

That's odd - I can update other attributes, but not datetime ones.Eric, are you using the UpdateResourceActivity and are you setting the DateTime field to a .NET DateTime value?I wonder if it it a region issue, has anyone else tried this or doing it via the Function Evaluator (see above)?Steve Mitchell Technical Director - Oxford Computer Group
December 16th, 2009 3:38pm

Yes, I use the UpdateResourceActivity.. this.updateResourceActivity1.UpdateParameters = new UpdateRequestParameter[] { new UpdateRequestParameter(TargetAttribute, UpdateMode.Modify, DateTime.UtcNow.AddDays(Convert.ToDouble(DaysFromToday))) };One thing to watch for is that they use a wierd datetime format internally and that may be tripping you up... If there is interest, I will consider posting this activity on the IDAGuys blog.... It is a simple "Put date + # of days on X attribute" activity... Nothing fancy... EricEric
Free Windows Admin Tool Kit Click here and download it now
December 16th, 2009 5:13pm

In what way wierd Eric? You are passing a DateTime object, which is what I am using.Also, I have had other people check the use of the Funtion Evaluator to set a date, and they get the same error as me - may not be related to this one of course...Steve Mitchell Technical Director - Oxford Computer Group
December 16th, 2009 6:52pm

Hi, found out what the problem is - passing in a DateTime field generates the error while using a Date field doesn'tThanks for you helpSteve Mitchell Technical Director - Oxford Computer Group
Free Windows Admin Tool Kit Click here and download it now
December 16th, 2009 8:16pm

If you look at the imports from the FIM MA, you see that DateTime data is in the format of YYYY-MM-DDTHH:MM:SS.000.. i.e. 2009-10-19T08:08:10.564 I haven't found a clean conversion...EricEric
December 17th, 2009 4:45pm

I have been using parseExact withyyyy-MM-ddTHH:mm:ss, seems to work if the date is updated via the portal, but if it is updated via a ActivitySettingResource it comes in the the milli-seconds followed by a Z. Got round the update issueby converting it to a string in the format above (without the T), then back to a Date before saving - sigh.Steve Mitchell Technical Director - Oxford Computer Group
Free Windows Admin Tool Kit Click here and download it now
December 17th, 2009 5:08pm

PS - in some cases I also have to split the string at the . and just use the main bodySteve Mitchell Technical Director - Oxford Computer Group
December 17th, 2009 5:20pm

Hi all, I just got the same problem. When I tried to update the expiration time from a custom activity, I got the following exception: Microsoft.ResourceManagement.WebServices.Exceptions.UnwillingToPerformException: Other ---> System.Data.SqlClient.SqlException: Reraised Error 50000, Level 16, State 1, Procedure ReRaiseException, Line 37, Message: Reraised Error 50000, Level 16, State 1, Procedure ReRaiseException, Line 37, Message: Reraised Error 515, Level 16, State 2, Procedure GenerateRequestOutput, Line 238, Message: Cannot insert the value NULL into column 'ValueDateTime', table 'FIMService.fim.RequestOutputDateTime'; column does not allow nulls. INSERT fails. The problem was solved converting the DateTime to UTC as in this example: UpdateRequestParameter parameter = new UpdateRequestParameter (); parameter.PropertyName = "ExpirationTime" ; parameter.Value = DateTime .Now.AddMonths(6 ).ToUniversalTime(); parameter.Mode = UpdateMode .Modify; m_updateResourceActivity.UpdateParameters = new UpdateRequestParameter []{ parameter }; Paolo Tedesco - http://cern.ch/idm
Free Windows Admin Tool Kit Click here and download it now
April 22nd, 2010 7:04pm

Try (in C#) this.updateResourceActivity1.UpdateParameters = new UpdateRequestParameter[] { new UpdateRequestParameter(TargetAttribute, UpdateMode.Modify, DateTime.UtcNow.AddDays(Convert.ToDouble(DaysFromToday))) }; Eric
April 22nd, 2010 7:11pm

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

Other recent topics Other recent topics