none
Dereference multivalued reference attribute to multivalued string attribute RRS feed

  • Question

  • How can I Dereference multivalued reference attribute to multivalued string attribute. I want to flow this multivalued string attribute to AD. 
    Friday, March 7, 2014 12:07 PM

Answers

  • Finally resolved the issue. Earlier I was using FIM built in Admin GUID as actor ID (7fb2b853-24f0-4498-9534-4e10589723c4). Thought of trying FIM service account as actor ID(e05d1f1b-3d5e-4014-baa6-94dee7d68c89) and it worked, no infinite loop. Strange FIM behaviour.
    • Marked as answer by Shobhitvaish Friday, March 14, 2014 12:23 PM
    Friday, March 14, 2014 12:02 PM

All replies

  • Hello

    There is no by design features to do that. I see two options:

    1. Write a Custom Activity
    2. Use a powershell script (called by custom activity powershell: http://fimpowershellwf.codeplex.com )

    Regards


    Sylvain

    Friday, March 7, 2014 1:59 PM
  • Thanks for reply. I know I can make use of ReadResourceActivity and UpdateResourceActivity by setting Actor ID, resource ID and Update parameters. I am stuck how to read multivalued reference attribute(say StoreListReference) and push the display name into multivalued string attribute(say StoreList). Can you please help me on this.
    Saturday, March 8, 2014 4:37 AM
  • Can someone help on this
    Saturday, March 8, 2014 9:51 AM
  • You need to loop through each value, use the ReadResourceActivity to get the referenced object and the value you want, and then the UpdateResourceActivity to store all the value.

    You can use a Replicator in WF to do the loop.


    Thanks, Brian

    Saturday, March 8, 2014 6:09 PM
    Moderator
  • I was able to develop the activity but it is going into infinite loop while inserting. Below is the code. Can you please guide where I am going wrong. Also as of now I have developed it only for inserting. I am using emuerateresourceactivity and added code activity using code.
    using System;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Collections;
    using System.Linq;
    using System.Workflow.ComponentModel.Compiler;
    using System.Workflow.ComponentModel.Serialization;
    using System.Workflow.ComponentModel;
    using System.Workflow.ComponentModel.Design;
    using System.Workflow.Runtime;
    using System.Workflow.Activities;
    using System.Workflow.Activities.Rules;
    using Microsoft.ResourceManagement.WebServices;
    using System.Collections.Generic;
    using Microsoft.ResourceManagement.Workflow.Activities;
    using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
    
    
    namespace DereferenceActivityLibrary
    {
        public partial class DereferenceActivity : SequenceActivity
        {
            List<UniqueIdentifier> storeList;
            SequentialWorkflow parentWorkflow = null;
            int loopCount = 0;
            Guid targetGUID;
            const string FIMAdminGUID = "7fb2b853-24f0-4498-9534-4e10589723c4";
            List<string> storeName = new List<string>();
            string xpathFilter = "";
            string resourceType = "JambaStore";
            public DereferenceActivity()
            {
                InitializeComponent();
            }
    
            private void initializeReadResource_ExecuteCode(object sender, EventArgs e)
            {
                if (!SequentialWorkflow.TryGetContainingWorkflow(this, out parentWorkflow))
                {
                    throw new InvalidOperationException("Unable to resove parent workflow");
                }
                readResourceActivity.ActorId = new Guid(FIMAdminGUID);
                readResourceActivity.ResourceId = parentWorkflow.TargetId;
                targetGUID = parentWorkflow.TargetId;
                readResourceActivity.SelectionAttributes = new string[] { "StoreListReference" };
            }
    
            private void initializeEnumerateResource_ExecuteCode(object sender, EventArgs e)
            {
                string filterDEL = "]";
                if (null == readResourceActivity.Resource)
                {
                    throw new InvalidOperationException("Unable to determine the current request");
                }
                ResourceType resource = readResourceActivity.Resource;
                storeList = resource["StoreListReference"] as List<UniqueIdentifier>;
                for (loopCount = 0; loopCount < storeList.Count; loopCount++)
                {
                    if (loopCount == 0)
                        xpathFilter += "/" + resourceType + "[(ObjectID='" + storeList[loopCount].GetGuid() + "')";
                    else
                        xpathFilter += " or (ObjectID='" + storeList[loopCount].GetGuid() + "')";
                }
    
                xpathFilter = xpathFilter + filterDEL;
                enumerateResourcesActivity.ActorId = new Guid(FIMAdminGUID);
                enumerateResourcesActivity.XPathFilter = xpathFilter;
            }
    
            private void readStoresNameActivity_ExecuteCode(object sender, EventArgs e)
            {
                ResourceType jambaStore = EnumerateResourcesActivity.GetCurrentIterationItem((CodeActivity)sender) as ResourceType;
                storeName.Add(jambaStore["DisplayName"].ToString());
            }
            private void initializeUpdateResourceActivity_ExecuteCode(object sender, EventArgs e)
            {
                List<UpdateRequestParameter> updateRequestParameters = new List<UpdateRequestParameter>();
                string targetAttribute = "Store";
                foreach (string store in storeName)
                {
                    updateRequestParameters.Add(new UpdateRequestParameter(targetAttribute, UpdateMode.Insert, store));
                }
                this.updateResourceActivity_ActorId1 = new Guid(FIMAdminGUID);
                this.updateResourceActivity_ResourceId1 = targetGUID;
                this.updateResourceActivity_ApplyAuthorizationPolicy1 = false;
                this.updateResourceActivity_UpdateParameters1 = updateRequestParameters.ToArray<UpdateRequestParameter>();
            }
    
            public static DependencyProperty updateResourceActivity_ActorId1Property = DependencyProperty.Register("updateResourceActivity_ActorId1", typeof(System.Guid), typeof(DereferenceActivityLibrary.DereferenceActivity));
    
            [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
            [BrowsableAttribute(true)]
            [CategoryAttribute("Parameters")]
            public Guid updateResourceActivity_ActorId1
            {
                get
                {
                    return ((System.Guid)(base.GetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_ActorId1Property)));
                }
                set
                {
                    base.SetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_ActorId1Property, value);
                }
            }
    
            public static DependencyProperty updateResourceActivity_ApplyAuthorizationPolicy1Property = DependencyProperty.Register("updateResourceActivity_ApplyAuthorizationPolicy1", typeof(System.Boolean), typeof(DereferenceActivityLibrary.DereferenceActivity));
    
            [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
            [BrowsableAttribute(true)]
            [CategoryAttribute("Parameters")]
            public Boolean updateResourceActivity_ApplyAuthorizationPolicy1
            {
                get
                {
                    return ((bool)(base.GetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_ApplyAuthorizationPolicy1Property)));
                }
                set
                {
                    base.SetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_ApplyAuthorizationPolicy1Property, value);
                }
            }
    
            public static DependencyProperty updateResourceActivity_ResourceId1Property = DependencyProperty.Register("updateResourceActivity_ResourceId1", typeof(System.Guid), typeof(DereferenceActivityLibrary.DereferenceActivity));
    
            [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
            [BrowsableAttribute(true)]
            [CategoryAttribute("Parameters")]
            public Guid updateResourceActivity_ResourceId1
            {
                get
                {
                    return ((System.Guid)(base.GetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_ResourceId1Property)));
                }
                set
                {
                    base.SetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_ResourceId1Property, value);
                }
            }
    
            public static DependencyProperty updateResourceActivity_UpdateParameters1Property = DependencyProperty.Register("updateResourceActivity_UpdateParameters1", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateRequestParameter[]), typeof(DereferenceActivityLibrary.DereferenceActivity));
    
            [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
            [BrowsableAttribute(true)]
            [CategoryAttribute("Parameters")]
            public UpdateRequestParameter[] updateResourceActivity_UpdateParameters1
            {
                get
                {
                    return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateRequestParameter[])(base.GetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_UpdateParameters1Property)));
                }
                set
                {
                    base.SetValue(DereferenceActivityLibrary.DereferenceActivity.updateResourceActivity_UpdateParameters1Property, value);
                }
            }
        }
    }
    
    using System;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Collections;
    using System.Reflection;
    using System.Workflow.ComponentModel.Compiler;
    using System.Workflow.ComponentModel.Serialization;
    using System.Workflow.ComponentModel;
    using System.Workflow.ComponentModel.Design;
    using System.Workflow.Runtime;
    using System.Workflow.Activities;
    using System.Workflow.Activities.Rules;
    
    namespace DereferenceActivityLibrary
    {
        public partial class DereferenceActivity
        {
            #region Activity Designer generated code
    
            /// <summary> 
            /// Required method for Designer support - do not modify 
            /// the contents of this method with the code editor.
            /// </summary>
            [System.Diagnostics.DebuggerNonUserCode]
            [System.CodeDom.Compiler.GeneratedCode("", "")]
            private void InitializeComponent()
            {
                this.CanModifyActivities = true;
                System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
                System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
                System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();
                System.Workflow.ComponentModel.ActivityBind activitybind4 = new System.Workflow.ComponentModel.ActivityBind();
                this.readStoresNameActivity = new System.Workflow.Activities.CodeActivity();
                this.updateResourceActivity = new Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity();
                this.initializeUpdateResourceActivity = new System.Workflow.Activities.CodeActivity();
                this.enumerateResourcesActivity = new Microsoft.ResourceManagement.Workflow.Activities.EnumerateResourcesActivity();
                this.initializeEnumerateResource = new System.Workflow.Activities.CodeActivity();
                this.readResourceActivity = new Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity();
                this.initializeReadResource = new System.Workflow.Activities.CodeActivity();
                this.currentRequestActivity = new Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity();
                // 
                // readStoresNameActivity
                // 
                this.readStoresNameActivity.Name = "readStoresNameActivity";
                this.readStoresNameActivity.ExecuteCode += new System.EventHandler(this.readStoresNameActivity_ExecuteCode);
                // 
                // updateResourceActivity
                // 
                activitybind1.Name = "DereferenceActivity";
                activitybind1.Path = "updateResourceActivity_ActorId1";
                activitybind2.Name = "DereferenceActivity";
                activitybind2.Path = "updateResourceActivity_ApplyAuthorizationPolicy1";
                this.updateResourceActivity.Name = "updateResourceActivity";
                activitybind3.Name = "DereferenceActivity";
                activitybind3.Path = "updateResourceActivity_ResourceId1";
                activitybind4.Name = "DereferenceActivity";
                activitybind4.Path = "updateResourceActivity_UpdateParameters1";
                this.updateResourceActivity.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.ActorIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
                this.updateResourceActivity.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.ApplyAuthorizationPolicyProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
                this.updateResourceActivity.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.ResourceIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
                this.updateResourceActivity.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.UpdateParametersProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
                // 
                // initializeUpdateResourceActivity
                // 
                this.initializeUpdateResourceActivity.Name = "initializeUpdateResourceActivity";
                this.initializeUpdateResourceActivity.ExecuteCode += new System.EventHandler(this.initializeUpdateResourceActivity_ExecuteCode);
                // 
                // enumerateResourcesActivity
                // 
                this.enumerateResourcesActivity.Activities.Add(this.readStoresNameActivity);
                this.enumerateResourcesActivity.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
                this.enumerateResourcesActivity.Name = "enumerateResourcesActivity";
                this.enumerateResourcesActivity.PageSize = 100;
                this.enumerateResourcesActivity.Selection = null;
                this.enumerateResourcesActivity.SortingAttributes = null;
                this.enumerateResourcesActivity.TotalResultsCount = 0;
                this.enumerateResourcesActivity.XPathFilter = null;
                // 
                // initializeEnumerateResource
                // 
                this.initializeEnumerateResource.Name = "initializeEnumerateResource";
                this.initializeEnumerateResource.ExecuteCode += new System.EventHandler(this.initializeEnumerateResource_ExecuteCode);
                // 
                // readResourceActivity
                // 
                this.readResourceActivity.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
                this.readResourceActivity.Name = "readResourceActivity";
                this.readResourceActivity.Resource = null;
                this.readResourceActivity.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
                this.readResourceActivity.SelectionAttributes = null;
                // 
                // initializeReadResource
                // 
                this.initializeReadResource.Name = "initializeReadResource";
                this.initializeReadResource.ExecuteCode += new System.EventHandler(this.initializeReadResource_ExecuteCode);
                // 
                // currentRequestActivity
                // 
                this.currentRequestActivity.CurrentRequest = null;
                this.currentRequestActivity.Name = "currentRequestActivity";
                // 
                // DereferenceActivity
                // 
                this.Activities.Add(this.currentRequestActivity);
                this.Activities.Add(this.initializeReadResource);
                this.Activities.Add(this.readResourceActivity);
                this.Activities.Add(this.initializeEnumerateResource);
                this.Activities.Add(this.enumerateResourcesActivity);
                this.Activities.Add(this.initializeUpdateResourceActivity);
                this.Activities.Add(this.updateResourceActivity);
                this.Name = "DereferenceActivity";
                this.CanModifyActivities = false;
    
            }
    
            #endregion
    
            private CodeActivity readStoresNameActivity;
    
            private Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity updateResourceActivity;
    
            private CodeActivity initializeEnumerateResource;
    
            private Microsoft.ResourceManagement.Workflow.Activities.EnumerateResourcesActivity enumerateResourcesActivity;
    
            private CodeActivity initializeReadResource;
    
            private Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity readResourceActivity;
    
            private CodeActivity initializeUpdateResourceActivity;
    
            private Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity currentRequestActivity;
    
    
    
    
    
    
    
    
        }
    }
    


    Wednesday, March 12, 2014 3:26 PM
  • Can anyone come up with some solution. Someone running into same issue.
    Thursday, March 13, 2014 3:33 AM
  • Can you also provide the design of your workflow?


    Sylvain

    Thursday, March 13, 2014 12:28 PM
  • Thanks for your reply. Here is the design.
    Thursday, March 13, 2014 1:26 PM
  • Seems like there is no solution :(
    Friday, March 14, 2014 6:28 AM
  • Hello,

    You also need to do a loop in your design. This loop need to include:

    • The enumerate activity
    • A read activity, to get the string attribute on each previous enumarated objects
    • Code to store values in a list (from the read activity)

    Sylvain

    Friday, March 14, 2014 9:55 AM
  • I believe loop task is accomplished by EnumerateResourceActivity. Also I am able to update the value. My issue is that update resource activity is going inside infnite loop.
    Friday, March 14, 2014 10:42 AM
  • Finally resolved the issue. Earlier I was using FIM built in Admin GUID as actor ID (7fb2b853-24f0-4498-9534-4e10589723c4). Thought of trying FIM service account as actor ID(e05d1f1b-3d5e-4014-baa6-94dee7d68c89) and it worked, no infinite loop. Strange FIM behaviour.
    • Marked as answer by Shobhitvaish Friday, March 14, 2014 12:23 PM
    Friday, March 14, 2014 12:02 PM