Help with UpdateRequestActivity in custom workflow activity
I am trying to create a custom workflow activity that uses an UpdateRequestActivity to update the original request with the results of my activity. I am using the following code to try to set up the UpdateRequestActivity: RequestStatusDetail rsd = new RequestStatusDetail(DetailLevel.Information, "Hello World"); RequestStatusDetail[] details = { rsd }; updateRequestActivity1.RequestStatusDetails = details; This code throws an execption when the workflow runs. It appears to occur on the assignment of the RequestStatusDetails property. From the service log trace I see: System.ArgumentException: Type 'Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType' for dependency property 'RequestStatusDetails' does not match with value type 'Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestStatusDetail[]'. Parameter name: value at System.Workflow.ComponentModel.DependencyObject.SetValueCommon(DependencyProperty dependencyProperty, Object value, PropertyMetadata metadata, Boolean shouldCallSetValueOverrideIfExists) at System.Workflow.ComponentModel.DependencyObject.SetValue(DependencyProperty dependencyProperty, Object value) at Microsoft.ResourceManagement.Workflow.Activities.UpdateRequestActivity.set_RequestStatusDetails(RequestStatusDetail[] value) at FIM.CustomWorkflowActivitiesLibrary.Activities.QueueSyncJobActivity.codeActivity1_ExecuteCode(Object sender, EventArgs e) at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e) at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run() Any suggestions? or does anyone have a working example of code for UpdateRequestActivity? I got the rough instructions last year in this thread (http://social.technet.microsoft.com/Forums/en/ilm2/thread/9d87004c-fccd-4265-971d-9032815cd2f8), but ended up just using execptions back then. I now have a need to add stuff to the RequestStatusDetail without ending the workflow. Interstingly enough, I can get the same execption within the Visual Studio environment if I try and use the designer to set up RequestStatusDetails property and assign it a value from within the property sheet. Thanks, Rex
March 17th, 2011 7:38am

Carol (MissMiis) has made an investigation on how to set RequestStatusDetail and blogged about it here . You should not use the UpdateRequestActivity for this since that activity is likely to disappear, use the UpdateResourceActivity instead! //HenrikHenrik Nilsson, ILM/FIM MVP Blog: http://www.idmcrisis.com Company: Cortego (http://www.cortego.se)
Free Windows Admin Tool Kit Click here and download it now
March 17th, 2011 9:55am

Carol (MissMiis) has made an investigation on how to set RequestStatusDetail and blogged about it here . You should not use the UpdateRequestActivity for this since that activity is likely to disappear, use the UpdateResourceActivity instead! //Henrik Henrik Nilsson, ILM/FIM MVP Blog: http://www.idmcrisis.com Company: Cortego (http://www.cortego.se) Actually, that's a bad idea. Requests are not like other objects in the FIM data system: they can be cached across partitions, they can be volatile, etc etc. They're also not necessarily in sync with what's persisted in SQL. For normal resources, you can use the UpdateResource activity as the SQL store is authoritative. But for updating requests, you should use the UpdateRequestActivity as it has special logic to check the caches first. If you don't go through this, then you may be getting some weird hard to reproduce errors that will cause you to pull your hair out. Henrik, what makes you say that the activity will disappear?ex-MSFT developer, now FIM/MIIS/ILM/WPF/Silverlight consultant | http://blog.aesthetixsoftware.com/
March 17th, 2011 12:53pm

Where is that bit of code being called? It looks right but I'm not seeing why the service log is saying you're trying to set it as type RequestType. Did you try to set a debugger at those breakpoints?ex-MSFT developer, now FIM/MIIS/ILM/WPF/Silverlight consultant | http://blog.aesthetixsoftware.com/
Free Windows Admin Tool Kit Click here and download it now
March 17th, 2011 12:59pm

Hmmm. That's bizarre. I'm looking at the RMS code through reflector and all that request caching logic is still there. I'll have to follow up with some of the PMs & Devsex-MSFT developer, now FIM/MIIS/ILM/WPF/Silverlight consultant | http://blog.aesthetixsoftware.com/
March 17th, 2011 1:14pm

My understanding is that UpdateRequestActivity should not be used as it is/will be discontinued (documentation has gone from dev ref). So to be on the safe side use UpdateResourceActivity as in my example already linked above by Henrik.http://www.wapshere.com/missmiis
Free Windows Admin Tool Kit Click here and download it now
March 17th, 2011 2:57pm

Where is that bit of code being called? It looks right but I'm not seeing why the service log is saying you're trying to set it as type RequestType. Did you try to set a debugger at those breakpoints? My custom activity has three stock activities: InvokeWebService, CodeActivity, and UpdateResourceActivity. The web service queues some external work, the code activity copies the results of the queue request to the update request activity, and the update request activity logs the status. The code I posted was the content of the CodeActivity and is all of the code. "QueueJobResult" is a bound property that contains the result of the web service call: string message = string.Format("Job queue returned: {0}", QueueJobResult); RequestStatusDetail rsd = new RequestStatusDetail(DetailLevel.Information, message); RequestStatusDetail[] details = { rsd }; updateRequestActivity1.RequestStatusDetails = details; When debugging, the execption is thrown upon assignment of RequestStatusDetails, but I don't see the execption from within the debugger. I need to figure out how to step into the operation. I think under the covers it is a property assignment, but it appears to tagged as "don't step into" on the debugger. Edit: I got the debugger to catch the exception (I had some filtered out). The exception is firing on the assignment of RequestStatusDetails. I have not figured out how to step into the property accessors for the UpdateRequestActivity object and examine why it is complaining. The UpdateRequestActivity still appears to be documented here: http://msdn.microsoft.com/en-us/library/microsoft.resourcemanagement.workflow.activities.updaterequestactivity.aspx but it is not on the summary page here: http://msdn.microsoft.com/en-us/library/microsoft.resourcemanagement.workflow.activities.aspx, so it is not clear to me what the official stance is. I saw Carol's blog posting but I have a hard time believing that the supported way of updating the request status details involves hand crafting an internal XML structure used by FIM. (It is however a cool hack...) So... can someone provide an "official" answer as to what the "supported" way of doing this is? (This being updating the "Request Workflow Remarks" data on the request history.)
March 17th, 2011 8:06pm

Have you tried setting first chance exceptions and disabling debug just my code? If you give me a stack trace, it might shed some light. So using reflector, I see that the UpdateRequestActivity->RequestUpdate dataexchange. Now I was working through the logic and it doesn't seem partition+cache safe. So I looked at the DoUpdateRequest sql sproc and past the consistency checking & state transition, it looks like RequestStatusDetails is just stored in the main attribute table, not the request tables. I still don't see how this solves the consistency problems but at this point, I'd reached my limit for reverse engineering. The way Carol's crafting her messages is valid and correct webservice calls (that's how the public client or the internal FIM client does it) (with the caveat that any schema changes will break any hardcoded message). I was only referring to Requests are special objects so modifying them directly may cause problems. But if it works for the RequestStatusDetails using UpdateResource (the normal sproc for updating objects), then go ahead and use that. If you get weird errors stamped on your request, then at least you know of a possible place to lookex-MSFT developer, now FIM/MIIS/ILM/WPF/Silverlight consultant | http://blog.aesthetixsoftware.com/
Free Windows Admin Tool Kit Click here and download it now
March 18th, 2011 1:28pm

I was able to catch the exception in the debugger. It is the same as was in the service trace log: System.ArgumentException occurred Message="Type 'Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType' for dependency property 'RequestStatusDetails' does not match with value type 'Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestStatusDetail[]'.\r\nParameter name: value" Source="System.Workflow.ComponentModel" ParamName="value" StackTrace: at System.Workflow.ComponentModel.DependencyObject.SetValueCommon(DependencyProperty dependencyProperty, Object value, PropertyMetadata metadata, Boolean shouldCallSetValueOverrideIfExists) at System.Workflow.ComponentModel.DependencyObject.SetValue(DependencyProperty dependencyProperty, Object value) at Microsoft.ResourceManagement.Workflow.Activities.UpdateRequestActivity.set_RequestStatusDetails(RequestStatusDetail[] value) at FIM.CustomWorkflowActivitiesLibrary.Activities.QueueSyncJobActivity.codeActivity1_ExecuteCode(Object sender, EventArgs e) at System.Workflow.ComponentModel.Activity.RaiseEvent(DependencyProperty dependencyEvent, Object sender, EventArgs e) at System.Workflow.Activities.CodeActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) InnerException:
March 21st, 2011 12:39am

Aaand now it's clear why it's no longer supported: it doesn't work because the dependency binding is wrong in the actual activity :). Congrats on finding the bug :) Here's what I'd strongly guess is happening inside that activity: 1. In the request activity, the property type is of RequestStatusDetails, but at some point, it was RequestType 2. The dependency property was not updated to reflect this: DependencyProperty.Register("RequestStatusDetails", typeof(RequestType), typeof(UpdateReques)); I guess the only way is to do Update Resourceex-MSFT developer, now FIM/MIIS/ILM/WPF/Silverlight consultant | http://blog.aesthetixsoftware.com/
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 12:12pm

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

Other recent topics Other recent topics