FIM Workflow Current Request is Null
Hello all - I am working on implementing Ensynch's ILM 2 Custom Workflow Activity (http://ilm2wfactivity.codeplex.com/) on FIM 2010 RTM, but am having an issue I can't seem to figure out. The workflow is registered in FIM and called at the right time, however the current request always appears to be null, and whenever any functions are ran against it, I get "Object reference not set to an instance of an object". I modified the code a bit to check for a null currentRequest, and it now does log "currentRequest is null" every time. The relevant code is below. Any thoughts? Thanks, Keith public RequestType currentRequest; protected override void OnSequenceComplete(ActivityExecutionContext executionContext) { try { if (null == this.currentRequest) { this.SimpleLogFunction("currentRequest is null"); } else { // Omitted for simplicity } } catch (Exception ex) { this.SimpleLogFunction("Request Exception = '" + ex.Message + "'"); } finally { base.OnSequenceComplete(executionContext); } }
June 21st, 2010 5:20pm

try this protected override void OnSequenceComplete(ActivityExecutionContext executionContext) { RequestType request = this.ReadRequest_Resource1 as RequestType; if (null == request) { throw new InvalidOperationException("no request."); } ................ ................ krish
Free Windows Admin Tool Kit Click here and download it now
June 21st, 2010 7:05pm

Hi Keith! There's supposed to be a binding for the LogRequestActivity.CurrentRequest targeting the currentRequest variable and maybe you've lost it somehow. Have a look at the code behind in the designer file and you should have something like: System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind(); ...and... activitybind1.Name = "EnsynchDiagnosticActivity"; activitybind1.Path = "currentRequest"; this.LogRequestActivity.Name = "LogRequestActivity";<br/> this.LogRequestActivity.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity.CurrentRequestProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1))); Personally I'm not that fond of bindings and I usually recommend not using bindings and do the same stuff in code instead and that could simply be done by adding this single line of code that does the same thing as all the rows above after the "try {" lines in the OnSequenceComplete event handler... this.currentRequest = this.LogRequestActivity.CurrentRequest; //Henrik Henrik Nilsson, ILM/FIM MVP Blog: http://www.idmcrisis.com Company: Cortego (http://www.cortego.se)
June 21st, 2010 9:42pm

The binding appears to be correct, but I added the following line in inside the try block: this.currentRequest = this.LogRequestActivity.CurrentRequest; But i get the same thing - calling "this.LogRequestActivity.CurrentRequest" yields "Object reference not set to an instance of an object". It seems like the currentRequest from FIM isn't making it over properly and I have no idea how to troubleshoot that. Keith
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2010 4:31pm

Hi Keith! In some way after a lot of fixing around to get it ready for RTM of FIM I got it working. You can download it from http://idmcrisis.com/upload/EnsynchILMActivity.zip , unfortunately it's a VS2010 project so it might be a little hard for you to get it into VS2008. Maybe you could do what I did and simply replace all the references instead to... Microsoft.IdentityManagement.WebUI.Controls version 4.0.3531.2 Microsoft.IdentityManagement.WFExtensionInterfaces version 4.0.3531.2 Microsoft.ResourceManagement version 4.0.3531.2 Any other references to the FIM assemblies can be removed. I've decided to use C:\Temp for log files and this is hardcoded in the SimpleLogFunction method of EnsynchDianosticActivityUI, the same as before except before it used to be C: and you have to give you FIM Service account rights to create files in that directory. //HenrikHenrik Nilsson, ILM/FIM MVP Blog: http://www.idmcrisis.com Company: Cortego (http://www.cortego.se)
June 22nd, 2010 6:16pm

Thanks for sharing the updated version Henrik. I figured out my issue after reviewing your code. I was missing the call to InitializeComponent(), which obviously would be a problem. Not sure how that disappeared, but all is well now! Thanks, Keith
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2010 6:57pm

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

Other recent topics Other recent topics