none
FIM 2010 Newbie question: How to determine previous attribute value during a custom Activity.

    Question

  • Hellos. We are exploring FIM 2010 and its quite a mystery.

    We wish to write a custom activity which amongst other things will recalculates some User's attributes if either first or lastname changes.

    I guess we *could* have a Rule which fires our WF/custom activity only if the firstname or lastname is modified but I hope to reduce the number of moving parts/complexity.

    So. How can we on a "modify" determine if an attribute's value has changed? (this can get quite messy with multi-valued attributes!)

    I am not totally sure just what data is available to the activity by the WF when creating this currentRequest RequestType object... is it ALL attributes with values or is it just those attributes with non-null values or those attributes or what!?

    Also, Looking at an Ensynch hack there is this block of code:

    switch (this.currentRequest.Operation)
                {
                    case OperationType.Create:
                        return "Create";
                    case OperationType.Delete:
                        return "Delete";
                    case OperationType.Enumerate:
                        return "Enumerate";
                    case OperationType.Get:
                        return "Get";
                    case OperationType.Pull:
                        return "Pull";
                    case OperationType.Put:
                        return "Put";
                    case OperationType.SystemEvent:
                        return "System Event";
                    default:
                        return "Unknown Operation";  

               }

     

    Could someone please explain what a Pull operation is.  And what is the difference between a 'Pull' and a 'Get'?

     

    Sorry to ask,  but this MS FIM 2010 documentation is diabolical.

    Monday, February 06, 2012 8:31 AM

Answers

  • the complexity will depend on your requirements:

    - if you need to calculate attribute flow based on firstname and lastname, use custom expression for declarative rules; if it does not satisfy your needs use classic code extension to control the outbound attribute flow

    - if you need to run some workflows  based on the modification, this is not going to be easy task if the user has access to modify more than his firstname, lastname

    you need to parse the request parameters, and check if any of these attributes are there

    Dim containingWorkflow As SequentialWorkflow = Nothing
    If Not SequentialWorkflow.TryGetContainingWorkflow(Me, containingWorkflow) Then
       Throw New InvalidOperationException("Unable to get Containing Workflow")
    End If
    
    Dim requestParameters As ReadOnlyCollection(Of UpdateRequestParameter) = Me.currentRequest.ParseParameters(Of UpdateRequestParameter)()
    
    Dim changed as boolean = false
    For Each rp as RequestParameter in requestParameters
    If rp.PropertyName = "FIRSTNAME" or rp.PropertyName = "LASTNAME" then
    changed = true
    exit for
    end if
    Loop
    
    if changed then
    ' do tasks
    end if
    
    

    after that you can set a boolean attribute on the user object "example: changed" to flag him as changed and group these users in a SET, so you can run workflows on them. and make sure to add at the last an action function evaluator activity to set the boolean "changed" attribute of the user back to false

    burn baby burn ... Idm Inferno
    Monday, February 06, 2012 11:54 AM
  • Just to add a minor clarification to Amer's response: The current request object is only going to return changed attributes on an update. That's why you can just check if the first and last name attributes are there to determine if there was a change.

     

     

    Monday, February 06, 2012 3:18 PM

All replies

  • the complexity will depend on your requirements:

    - if you need to calculate attribute flow based on firstname and lastname, use custom expression for declarative rules; if it does not satisfy your needs use classic code extension to control the outbound attribute flow

    - if you need to run some workflows  based on the modification, this is not going to be easy task if the user has access to modify more than his firstname, lastname

    you need to parse the request parameters, and check if any of these attributes are there

    Dim containingWorkflow As SequentialWorkflow = Nothing
    If Not SequentialWorkflow.TryGetContainingWorkflow(Me, containingWorkflow) Then
       Throw New InvalidOperationException("Unable to get Containing Workflow")
    End If
    
    Dim requestParameters As ReadOnlyCollection(Of UpdateRequestParameter) = Me.currentRequest.ParseParameters(Of UpdateRequestParameter)()
    
    Dim changed as boolean = false
    For Each rp as RequestParameter in requestParameters
    If rp.PropertyName = "FIRSTNAME" or rp.PropertyName = "LASTNAME" then
    changed = true
    exit for
    end if
    Loop
    
    if changed then
    ' do tasks
    end if
    
    

    after that you can set a boolean attribute on the user object "example: changed" to flag him as changed and group these users in a SET, so you can run workflows on them. and make sure to add at the last an action function evaluator activity to set the boolean "changed" attribute of the user back to false

    burn baby burn ... Idm Inferno
    Monday, February 06, 2012 11:54 AM
  • Just to add a minor clarification to Amer's response: The current request object is only going to return changed attributes on an update. That's why you can just check if the first and last name attributes are there to determine if there was a change.

     

     

    Monday, February 06, 2012 3:18 PM
  • Great! Thats what I wanted to know.

    On a modify, the request (for modification) gets only the attributes which have been changed!

    So if first and last name are not present then it aint a Rename type modify operation! Wonderful.

     

    It is unclear from the documentation just what is presented.. I thought maybe I had to work out myself if the value had changed.

    Monday, February 06, 2012 3:24 PM
  • The workflow stuff does seem to be easier to learn via trial and error than any documentation. :-) Good luck!

    Monday, February 06, 2012 4:04 PM