When I first started out with MIIS I found the coding heavy going – but soon realised that the same few extension-writing methods are used for pretty much everything, and the fun bit was just how much I could achieve with them!
Now on to FIM and I have struggled every bit as much with learning how to write workflow activities, not particularly helped by the official documentation which I can only assume is computer generated, it is so completely unhelpful. But after a recent obsessive spate I’m finally starting to get the hang of it, and this has brought me to the next fantasy activity on my list – something to generate a unique attribute, such as an AccountName.
10th May 2011: I have just uploaded a new version of the activity. It has some more error checking and extra options for character-replacement and regular expression pattern matching. You will find the Download link further down this page.
The idea
What I want is a way to generate an attibute based on a series of rules. If I don’t get a unique value with the first (ideal) rule, then I move to the second, then the third, then if completely desperate the fourth… Hopefully I’d have found something good by then.
In an effort to reduce effort (if you can have that) this activity relies on the OOB Function activity to generate the possible strings in order of preference. So here’s what the workflow looks like configured with three possible choices:
And here is one of the Function activties, which generates a string and puts it in a WorkflowData parameter:
Developing the Activity
This activity is complicated compared to my powershell one, so I’ll just summarise the steps.
As well there are a bunch of code activities which smooth the way, setting up parameters and passing variables around. |
The Code
Here is the most recent copy of the solution. You will have to compile it yourself. Make sure you understand what it is doing and adapt the code for your own purposes.
Offered as an example only with NO WARRANTY and NO SUPPORT: Download Code
AIC Configuration
Activity Name: FIM.CustomWorkflowsActivityLibrary.GenerateUnique
Assembly Name: FIM.CustomWorkflowsActivityLibrary, version=1.0.0.0, Culture=Neutral, PublicKeyToken=abd0a8713d768ea1
Is Action: yes
Ttype Name: FIM.CustomWorkflowsActivityLibrary.GenerateUniqueUI
Logging
This activity logs to the Application Event Log, but only if you first register the source liek this:
new-eventlog -LogName “Application” -Source “FIM Custom Workflow”
Other Reading
If, like me, you’re doing this WWF development stuff for the first time, I did find this short tutorial very helpful. Despite my rubbishing the MSDN FIM documentation above, there is lots of good stuff there too, of course.
{ 6 } Comments
Carol-
A ResolveGrammarActivity will convert those [//WorkflowData/] values (as well as //Target and //Requestor) in to actual values. Assign the XPath expression to GrammarExpression and you can get the output from ResolvedExpression.
Hi Brian,
yes everyone seems very keen on this ResolveGrammarActivity, but while the official documentation says “for internal FIM use only” and “not supported” I will be avoiding it. I think it would only have saved me a few lines of code anyway.
How do I install this activity please help. I am new to fim 2010
I suggest you work through the example on MSDN – see http://msdn.microsoft.com/en-us/library/ff859524.aspx
I followed the example I entered the following values in the FIM Portal
Activity Name: FIM.CustomWorkflowsActivityLibrary.GenerateUnique
Assembly Name: GenerateUnique, version=1.0.0.0, Culture=Neutral, PublicKeyToken=abd0a8713d768ea1
Type Name: FIM.CustomWorkflowsActivityLibrary.WebUIs.GenerateUniqueUI
but the Activity is not showing up in the FIM Portal
Did you iisreset? If so, and it’s still not there, double check your actual class names by using the Object Browser in Visual Studio.
Post a Comment