locked
Type Projection Component Path "Element not valid", referencing relationship within same MP RRS feed

  • Question

  • My problems began with an issue with a custom relationship not being assigned properly, the exact scenario being represented in this thread: http://social.technet.microsoft.com/Forums/en-US/systemcenterservicemanager/thread/de82ac9f-2fcf-46a9-94eb-e50b4a94fd80?prof=required.  I am attempting to implement the fix listed in that thread, however I must be missing or failing to adapt something as my management pack is repeatedly giving me errors.  Specifically here is the error I get when I try to save or edit my MP in the authoring tool:

    "Service Manager Authoring Tool
    The management pack could not be verified due to this error:

    Failed to verify TypeProjection: CustomForm_7beb4ea2_88d9_46d9_b0fc_fb73ce348a07_TypeProjection Verification failed with 1 errors:
    Error 1:
    : Failed to verify TypeProjection: CustomForm_7beb4ea2_88d9_46d9_b0fc_fb73ce348a07_TypeProjection
    Failed to verify component path $Context/Path[Relationship='Activity!System.WorkItemContainsActivity']$ for component with alias Activity.  Failed to verify component path $Context/Path[Relationship='Activity.AD.User']$ for component with alias ADUser.  The path validation failed. Element not valid: Path[Relationship='Activity.AD.User']$"

    I've been pouring over the SDK information on Technet, the other component paths in the MP, and the example in the posted fix (the hyperlink above), but I can't figure out what I'm missing.  Any information that can help would be most appreciated.

    Here's the relevant code:

    <RelationshipTypes>
    <RelationshipType ID="Activity.AD.User" Accessibility="Public" Abstract="false" Base="System!System.Reference">
     <Source ID="AutoActivity" MinCardinality="0" MaxCardinality="2147483647" Type="AutomaticActivity"/>
     <Target ID="MS.ADUser" MinCardinality="0" MaxCardinality="1" Type="MicrosoftWindowsLibrary!Microsoft.AD.User"/>
     </RelationshipType>
     </RelationshipTypes>
    <EnumerationTypes>
     <EnumerationValue ID="ChangeTeamName" Accessibility="Public"/>
     <EnumerationValue ID="ChangeApplication" Accessibility="Public"/>
     </EnumerationTypes>
    <TypeProjections>
    <TypeProjection ID="CustomForm_7beb4ea2_88d9_46d9_b0fc_fb73ce348a07_TypeProjection" Accessibility="Public" Type="Change!System.WorkItem.ChangeRequest">
    <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity']$" Alias="Activity">
     <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' SeedRole='Target']$" Alias="ParentWorkItem"/>
     <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemCreatedByUser']$" Alias="ActivityCreatedBy"/>
     <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" Alias="ActivityAssignedTo"/>
     <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemAboutConfigItem']$" Alias="ActivityAboutConfigItem"/>
    <Component Path="$Context/Path[Relationship='Activity!System.ReviewActivityHasReviewer']$" Alias="Reviewer">
     <Component Path="$Context/Path[Relationship='Activity!System.ReviewerIsUser']$" Alias="User"/>
     <Component Path="$Context/Path[Relationship='Activity!System.ReviewerVotedByUser']$" Alias="VotedBy"/>
     </Component>
     <Component Path="$Context/Path[Relationship='Activity.AD.User']$" Alias="ADUser"/>
     </Component>
    

    The line I added, per the instructions in the other technet article, is the last one in the list.  The format looks correct to me, and the relationship is located within the same management pack, so I'm at a loss for the problem.

    Friday, March 23, 2012 6:30 PM

Answers

  • ok, I just tried this in my environment so I wouldn't make a fool of myself again :)

    So, the issue is that you have a relationship source which is a particular class (I'm assuming it is inherited from the System.WorkItem.Activity class).

    In your type projection, you're saying 2 things. 1) "Give me all the activities." 2) "Then give me the users related to AutomaticActivity"..unfortunately, the part 1 has no idea what an "AutomaticActivity" is. It only knows what System.WorkItem.Activity is. Your relationship is sourced to AutomaticActivity, not System.WorkItem.Activity.

    So, delete your last component and underneath the last closing component tag, copy this in

    <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' TypeConstraint='AutomaticActivity']$" Alias="AutomaticActivities">
        <Component Path="$Context/Path[Relationship='Activity.AD.User']$" Alias="ADUser" />
    </Component>

    This is telling your type projection "Give me all the AutomaticActivities related to the change request." This, in effect, is "scoping" the component down to your specific class type. Then, you are requesting all of the AD User's related to the AutomaticActivities..this works because the component is now in the correct context.

    Here's the new type projection in its entirety

    <TypeProjection ID="CustomForm_7beb4ea2_88d9_46d9_b0fc_fb73ce348a07_TypeProjection" Accessibility="Public" Type="Change!System.WorkItem.ChangeRequest">
      <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity']$" Alias="Activity">
        <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' SeedRole='Target']$" Alias="ParentWorkItem"/>
        <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemCreatedByUser']$" Alias="ActivityCreatedBy"/>
        <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" Alias="ActivityAssignedTo"/>
        <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemAboutConfigItem']$" Alias="ActivityAboutConfigItem"/>
        <Component Path="$Context/Path[Relationship='Activity!System.ReviewActivityHasReviewer']$" Alias="Reviewer">
          <Component Path="$Context/Path[Relationship='Activity!System.ReviewerIsUser']$" Alias="User"/>
          <Component Path="$Context/Path[Relationship='Activity!System.ReviewerVotedByUser']$" Alias="VotedBy"/>
        </Component>
      </Component>
      <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' TypeConstraint='AutomaticActivity']$" Alias="AutomaticAct">
        <Component Path="$Context/Path[Relationship='Activity.AD.User']$" Alias="ADUser"/>
      </Component>
    </TypeProjection>

    Now, if I'm not mistaken, you're using this for a form customization? Let's make sure this type projection loads first, then we'll have to tweak your form customization to make sure it makes use of this new component.
    Friday, March 23, 2012 8:22 PM

All replies

  • disclaimer: I haven't had a chance to try this in my environment.

    Try changing your last line to this:

    <Component Path="$Context/Path[Relationship='Activity.AD.User' TypeConstraint='AutomaticActivity']$" Alias="ADUser"/>

    If it works, I'll explain why..if it doesn't, I'll load up your scenario into my environment later this evening and try to reproduce it :)

    Friday, March 23, 2012 7:12 PM
  • Aaron,

    I tried your suggestion but unfortunately the MP still had the same validation error (except adding the "TypeConstraint" bit into the Relationship Path).  I appreciate the try, though.  Is there any other parts of my MP you need to load the scenario in your environment?
    Friday, March 23, 2012 7:27 PM
  • Sorry about that, i realized what i did wrong just as you replied. I didn't have a chance to edit my reply! I'm trying this real quick, I'll get back to you in a couple minutes.

    Friday, March 23, 2012 8:10 PM
  • ok, I just tried this in my environment so I wouldn't make a fool of myself again :)

    So, the issue is that you have a relationship source which is a particular class (I'm assuming it is inherited from the System.WorkItem.Activity class).

    In your type projection, you're saying 2 things. 1) "Give me all the activities." 2) "Then give me the users related to AutomaticActivity"..unfortunately, the part 1 has no idea what an "AutomaticActivity" is. It only knows what System.WorkItem.Activity is. Your relationship is sourced to AutomaticActivity, not System.WorkItem.Activity.

    So, delete your last component and underneath the last closing component tag, copy this in

    <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' TypeConstraint='AutomaticActivity']$" Alias="AutomaticActivities">
        <Component Path="$Context/Path[Relationship='Activity.AD.User']$" Alias="ADUser" />
    </Component>

    This is telling your type projection "Give me all the AutomaticActivities related to the change request." This, in effect, is "scoping" the component down to your specific class type. Then, you are requesting all of the AD User's related to the AutomaticActivities..this works because the component is now in the correct context.

    Here's the new type projection in its entirety

    <TypeProjection ID="CustomForm_7beb4ea2_88d9_46d9_b0fc_fb73ce348a07_TypeProjection" Accessibility="Public" Type="Change!System.WorkItem.ChangeRequest">
      <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity']$" Alias="Activity">
        <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' SeedRole='Target']$" Alias="ParentWorkItem"/>
        <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemCreatedByUser']$" Alias="ActivityCreatedBy"/>
        <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" Alias="ActivityAssignedTo"/>
        <Component Path="$Context/Path[Relationship='WorkItem!System.WorkItemAboutConfigItem']$" Alias="ActivityAboutConfigItem"/>
        <Component Path="$Context/Path[Relationship='Activity!System.ReviewActivityHasReviewer']$" Alias="Reviewer">
          <Component Path="$Context/Path[Relationship='Activity!System.ReviewerIsUser']$" Alias="User"/>
          <Component Path="$Context/Path[Relationship='Activity!System.ReviewerVotedByUser']$" Alias="VotedBy"/>
        </Component>
      </Component>
      <Component Path="$Context/Path[Relationship='Activity!System.WorkItemContainsActivity' TypeConstraint='AutomaticActivity']$" Alias="AutomaticAct">
        <Component Path="$Context/Path[Relationship='Activity.AD.User']$" Alias="ADUser"/>
      </Component>
    </TypeProjection>

    Now, if I'm not mistaken, you're using this for a form customization? Let's make sure this type projection loads first, then we'll have to tweak your form customization to make sure it makes use of this new component.
    Friday, March 23, 2012 8:22 PM
  • That worked perfectly!  Excellent!

    Thank you very much for the assistance, Aaron.

    I want to make sure I understand what we've done here.  Because the relationship between my custom class (AutomaticActivity) and the Change Request class comes by way of the System.WorkItem.Activity, I can't directly enter a reference to the custom class and expect it to work, even if that class is defined with the same management pack.  Instead, I have to reference the relationship between the classes, in this case, "System.WorkItemContainsActivity", scope that down to my custom class with the TypeConstraint, and then enter the path to my relationship as a child.  I have to "connect the dots", so to speak, correct?

    I am using this for a custom form.  I have a class I created which inherits from AutomaticActivity and needs to inherit the relationship with Microsoft.AD.User in order to use a User Picker to select a user and have another two fields (bound to properties on the relationship) display property values of the selected user.  In my previous arrangement, it worked when viewed as a template, but failed to work when the activity form was viewed from within a change request.  According to the other thread, that's because I had to add the definition of the relationship to the change request TypeProjection, as we've just done.  I will update my other MP and test it with our changes and report back if it works.

    Thanks again!

    Friday, March 23, 2012 8:44 PM
  • Hi Aaron,

    Here's a heads-up on the current situation - the MP with the CR form customization did successfully seal and everything that was working before is working now.  However, I am still having the same initial problem, that being that when I save my custom activity within a change request, it does not save any data in the user picker bound to the Microsoft.AD.User relationship.

    Since it's not the exact issue I opened this thread for, and there are already threads for that problem, I am posting more information in the following thread to attempt to continue to seek advice to solve the issue.  That thread is here: http://social.technet.microsoft.com/Forums/en-US/customization/thread/232dd076-4cbc-4ccd-b542-b2b81cece8bf?prof=required

    If you have any further suggestions, though, I would be grateful to hear them.  Thank you for your assistance to this point!

    Monday, March 26, 2012 3:21 PM