none
Custom Workflow - How to get requested changes to a multivalue attribute RRS feed

  • Question

  • I'm trying to create a custom workflow that updates groupmemberships in AD (this particular case can't be done via SyncRules, long story^^). For that I've created a new user attribute (in the portal) "memberOf".

    Now I want to create an AuthZ-Workflow that gets triggered when this attribute is modified. That all works well. My problem is how to figure out which values were added and which were removed to the multi-value attribute.

    I've tried this:

    var requestParameters = ReadCurrentRequestActivity_CurrentRequest.ParseParameters<UpdateRequestParameter>();
                
    using (TextWriter writer = File.CreateText(newValueFilePath))
    {
        foreach (UpdateRequestParameter requestParameter in requestParameters)
        {
            writer.Write(requestParameter.PropertyName + ":");
            writer.WriteLine("Type: " + requestParameter.Operation);
            writer.WriteLine();
            writer.Write(requestParameter.Value);
            writer.WriteLine();
            writer.WriteLine();
        }
    }

    This correctly gives me all the values that were added and removed. I was assuming the "Operation" property would tell me if the value was added or remove. But it always is "Create".

    So is there another "easy" way to figure this out? Two more complicated possibilities come to mind:

    - using a "ReadResourceActivity" to get the old value and then "manually" compute the changes

    - creating two different activity workflows, one for adding and one for removing; then I could create two seperate MPRs for the two cases

    They would probably work, but I think there has to be a "better" way.

    Thx

    Thursday, June 6, 2013 1:45 PM

Answers

  • Silly me, the attribute I was looking for is "Mode" not "Operation". According to the documentation "Operation" is always "Create"...
    • Marked as answer by TS007 Friday, June 7, 2013 12:27 PM
    Friday, June 7, 2013 12:27 PM

All replies

  • You might be better of with another attribute to store the old value to see what the difference is. Then act on the result.
    Thursday, June 6, 2013 8:31 PM
  • Silly me, the attribute I was looking for is "Mode" not "Operation". According to the documentation "Operation" is always "Create"...
    • Marked as answer by TS007 Friday, June 7, 2013 12:27 PM
    Friday, June 7, 2013 12:27 PM