locked
Change form does not save custom activity relationship RRS feed

  • Question

  • I have created a new relationship on activity called WorkItemAssignedToGroup:

    <RelationshipType ID="WorkItemAssignedToGroup" Accessibility="Public" Abstract="false" Base="System!System.Reference">
              <Source ID="Source_06207907_e5e7_4e36_bbe7_5e4fa67f9464" MinCardinality="0" MaxCardinality="2147483647" Type="ActivityLbrary!System.WorkItem.Activity" />
              <Target ID="Target_2efb8bff_8091_4539_bf37_1efe2d9a31c6" MinCardinality="0" MaxCardinality="1" Type="WindowsLibrary!Microsoft.AD.Group" />
    </RelationshipType>

    And I have put a userpcker control on the manual activity form with correct bindings. the relation is saved successfully when applied on existing manual activities. Meanwhile I have defined projection which contain the relation and they work as expected.

    I have tried to save the value in a change request, but the value is not saved in the activity. Here is what I do:

    Open a change Request > Go to Activities > Open Manual Activity (XYZ) > Enter a value for the group assignee > Click OK > Open Manual Activity (XYZ) (Note I haven't saved te change request yet) and the value of the group assignee is lost.

    The same problem exisits in save change request in a template. When a value is not saved it usually is because of faulty projection, so I tries to change the CR form projection:

    <TypeProjection ID="CustomForm_5a892103_b30a_4e77_9b15_b09e1af4be3e_TypeProjection" Accessibility="Public" Type="ChangeLibrary!System.WorkItem.ChangeRequest">
              <Component Path="$Context/Path[Relationship='ActivityLibrary!System.WorkItemContainsActivity']$" Alias="Activity">
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.WorkItemContainsActivity' SeedRole='Target']$" Alias="ParentWorkItem" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemCreatedByUser']$" Alias="ActivityCreatedBy" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="ActivityAssignedTo" />
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ActivityCanBeEditedByUser']$" Alias="ActivityCanBeEditedBy" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAboutConfigItem']$" Alias="ActivityAboutConfigItem" />
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.DependentActivityDependsOnWorkItem' SeedRole='Target']$" Alias="DependentActivity" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemRelatesToConfigItem']$" Alias="RelatedConfigItem" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemRelatesToWorkItem']$" Alias="RelatedWorkItem">
                  <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="RelatedWorkItemAssignedTo" />
                </Component>
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemRelatesToWorkItem' SeedRole='Target']$" Alias="RelatedWorkItemSource">
                  <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="RelatedWorkItemAssignedTo" />
                </Component>
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemHasFileAttachment']$" Alias="FileAttachment">
                  <Component Path="$Context/Path[Relationship='SystemSupportingItem!System.FileAttachmentAddedByUser']$" Alias="FileAttachmentAddedBy" />
                </Component>
                <Component Path="$Context/Path[Relationship='KnowledgeLibrary!System.EntityLinksToKnowledgeDocument']$" Alias="RelatedKnowledge" />
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ReviewActivityHasReviewer']$" Alias="Reviewer">
                  <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ReviewerIsUser']$" Alias="User" />
                  <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ReviewerVotedByUser']$" Alias="VotedBy" />
                </Component>
              </Component>
              <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemCreatedByUser']$" Alias="CreatedBy" />
              <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="AssignedTo" />
    ...
              <Component Path="$Context/Path[Relationship='ActivityLibrary!System.WorkItemContainsActivity' TypeConstraint='ActivityLibrary!System.WorkItem.Activity.ManualActivity']$" Alias="AutomaticAct">
                <Component Path="$Context/Path[Relationship='CustomManualActivity!WorkItemAssignedToGroup']$" Alias="ManualActivityGroupAssignee" />
              </Component>
            </TypeProjection>

    Seaparate cmponent is defined base on this thread, I can use the projection in a view and it works fine, but when on a change form, this does not work.

    So I change the projection using existing component:

    <TypeProjection ID="CustomForm_5a892103_b30a_4e77_9b15_b09e1af4be3e_TypeProjection" Accessibility="Public" Type="ChangeLibrary!System.WorkItem.ChangeRequest">
              <Component Path="$Context/Path[Relationship='ActivityLibrary!System.WorkItemContainsActivity']$" Alias="Activity">
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.WorkItemContainsActivity' SeedRole='Target']$" Alias="ParentWorkItem" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemCreatedByUser']$" Alias="ActivityCreatedBy" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="ActivityAssignedTo" />
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ActivityCanBeEditedByUser']$" Alias="ActivityCanBeEditedBy" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAboutConfigItem']$" Alias="ActivityAboutConfigItem" />
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.DependentActivityDependsOnWorkItem' SeedRole='Target']$" Alias="DependentActivity" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemRelatesToConfigItem']$" Alias="RelatedConfigItem" />
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemRelatesToWorkItem']$" Alias="RelatedWorkItem">
                  <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="RelatedWorkItemAssignedTo" />
                </Component>
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemRelatesToWorkItem' SeedRole='Target']$" Alias="RelatedWorkItemSource">
                  <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemAssignedToUser']$" Alias="RelatedWorkItemAssignedTo" />
                </Component>
                <Component Path="$Context/Path[Relationship='WorkItemLibrary!System.WorkItemHasFileAttachment']$" Alias="FileAttachment">
                  <Component Path="$Context/Path[Relationship='SystemSupportingItem!System.FileAttachmentAddedByUser']$" Alias="FileAttachmentAddedBy" />
                </Component>
                <Component Path="$Context/Path[Relationship='CustomManualActivity!WorkItemAssignedToGroup']$" Alias="ManualActivityGroupAssignee" />
                <Component Path="$Context/Path[Relationship='KnowledgeLibrary!System.EntityLinksToKnowledgeDocument']$" Alias="RelatedKnowledge" />
                <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ReviewActivityHasReviewer']$" Alias="Reviewer">
                  <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ReviewerIsUser']$" Alias="User" />
                  <Component Path="$Context/Path[Relationship='ActivityLibrary!System.ReviewerVotedByUser']$" Alias="VotedBy" />
                </Component>
              </Component>
    ...
    </TypeProjection>

    Still the same problem! I can use the projection in views, but when on a change form, activity does not hold the vlaue selected.

    Sholud I user FormUtilities.Instance.FetchAndMergeSubProjection in the manual activity form based on this thread?

    Thanks


    YSobhdel


    Saturday, April 11, 2020 11:15 AM