How to: Add Action Log to Change Request Form
You may have noticed that the Change Request Form does not show an Action log out of the box.
This article explains the required steps to add the Action log as you know it from Incident requests to the Change Request Form
Modify the Form
This section explains how to modify the Form to display the Action Log element
- Create a copy of
itsmportalv3\Areas\Analyst\Views\Forms\WI_ChangeRequest\WI_ChangeRequest_GeneralTab.cshtml
- Name your copy
WI_ChangeRequest_GeneralTab_custom.cshtml
- Open the copy and insert the following line at the end, right before the last
</div>
tag:
<itx-actionlog analyst-log="AnalystComments" system-log="ActionLogs" user-log="UserComments" attachments="FileAttachments" />
- Save changes
The end of your file should look like the following:
Create Type Projection
If you open a Change Request in the Portal at this point, you will notice that the Action log is displayed, but it seems like it is not working correctly.
This is because the default type projection for this form is missing the following components that are vital for the Action log:
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasActionLog' TypeConstraint='WorkItem!System.WorkItem.TroubleTicket.ActionLog']$" Alias="ActionLogs" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasCommentLog' TypeConstraint='WorkItem!System.WorkItem.TroubleTicket.AnalystCommentLog']$" Alias="AnalystComments" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasCommentLog' TypeConstraint='WorkItem!System.WorkItem.TroubleTicket.UserCommentLog']$" Alias="UserComments" />
The following Management pack defines a new type projection for Change Requests that includes those components. You may simply copy paste or even download it and import it to SCSM
<ManagementPack ContentReadable="true" SchemaVersion="2.0" OriginalSchemaVersion="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<Manifest>
<Identity>
<ID>custom.ITSMPortal.Analyst.Configuration</ID>
<Version>1.0.0.1</Version>
</Identity>
<Name>Custom ITSM Analyst Portal Configuration</Name>
<References>
<Reference Alias="WorkItem">
<ID>System.WorkItem.Library</ID>
<Version>7.5.3079.607</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="ChangeRequest">
<ID>System.WorkItem.ChangeRequest.Library</ID>
<Version>7.5.3079.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
<Reference Alias="SupportingItem">
<ID>System.SupportingItem.Library</ID>
<Version>7.5.3079.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
</References>
</Manifest>
<TypeDefinitions>
<EntityTypes>
<TypeProjections>
<TypeProjection ID="custom.ITSMPortal.Analyst.ChangeRequest.ProjectionType" Accessibility="Public" Type="ChangeRequest!System.WorkItem.ChangeRequest">
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemRequestedByUser']$" Alias="RequestedByUser" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemAssignedToUser']$" Alias="AssignedUser" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemCreatedByUser']$" Alias="CreatedByUser" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemClosedByUser']$" Alias="ClosedByUser" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasActionLog' TypeConstraint='WorkItem!System.WorkItem.TroubleTicket.ActionLog']$" Alias="ActionLogs" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasCommentLog' TypeConstraint='WorkItem!System.WorkItem.TroubleTicket.AnalystCommentLog']$" Alias="AnalystComments" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasCommentLog' TypeConstraint='WorkItem!System.WorkItem.TroubleTicket.UserCommentLog']$" Alias="UserComments" />
<Component Path="$Target/Path[Relationship='WorkItem!System.WorkItemHasFileAttachment']$" Alias="FileAttachments">
<Component Path="$Target/Path[Relationship='SupportingItem!System.FileAttachmentAddedByUser']$" Alias="FileAttachmentAddedBy" />
</Component>
</TypeProjection>
</TypeProjections>
</EntityTypes>
</TypeDefinitions>
</ManagementPack>
Adjust Form Settings
Even after importing a management pack defining the required type projection, the Action log still seems to be broken.
This is because you need to let the portal know what type projection is used for which form. Follow the steps below to set your new type projection for the default Change Request Form:
- Open the ITSM Portal
- Click on your username and select "Settings" from the dropdown
- In the Portal settings, select the "Analyst Forms Settings" Tab
- On the "Add New Form" panel, fill in the following values:
a. Target Class:System.WorkItem.ChangeRequest
b. Type Projection:custom.ITSMPortal.Analyst.ChangeRequest.ProjectionType
(or whatever you have named your custom type projection)
c. Default Form:WI_ChangeRequest\WI_ChangeRequest_DefaultForm
- Click Save
The Form Settings list should now have the customized entry as shown below:
Done! The Action Log should now work properly with Change Requests in the Analyst Portal