As you may already know if you have a column with a multiItemLink type it is not possible to have sub-columns using dot notation (binding=item.severity)
In this article, we are going to show you how to create sub-columns for the multiItemLink columns using the "serverRender" functionality.
- Sub-column for multiItemLink column (upstream)
Imagine there is an upstream traceability column that shows the multiple System Requirement WIs linked to the Risk item.
Every System Requirement has a Severity property, that you'd like to show in an additional sub-column "Severity".
You can achieve this with the help of the "serverRender" property.
- Create a "Severity" column as usual, except do NOT add there a "binding" parameter;
- Instead, add there the following "serverRender" snippet, considering that "systemrequirement" is an ID of WI type:
"serverRender": "<ol style='margin-block-start: -16px;margin-block-end: -16px;padding-inline-start: 16px;'>#foreach($linkedWorkItem in $item.fields().linkedWorkItems()) #set($sysReq = $linkedWorkItem.fields().workItem().get()) #set($typeId = $sysReq.fields().type().get().id()) #if($typeId.equals(\"systemrequirement\")) <li> $sysReq.fields().severity().render().withIcon(true).htmlFor().forFrame() </li> #end #end</ol>"
As a result of using that "serverRender" functionality, there would be a column with rendered Severity properties for every System Requirement item:
In case you want the "Severity" value to be rendered in one column together with the Item Link, check the following article: Customize the way Item Links are rendered
- Sub-column for multiItemLink column (backlink)
Additionally, the same approach could be used for the downstream traceability items.
If you would like to have a multiItemLink downstream column "issue" shown in a separate column check the following article, "Back Links" section: Configure Up-stream Traceability Column
For this use case to display the "Severity" sub-column, we'll need to search for all Work Items of type "Issue" and before rendering the Severity value, sort the Work Items by their ID:
"serverRender": "<ol style='margin-block-start: -16px;margin-block-end: -16px;padding-inline-start: 16px;'>#foreach($issueWi in $item.transaction().workItems().search().query(\"type:issue AND linkedWorkItems:${item.getReference().projectId()}/${item.getReference().id()}\").sort(\"id\")) <li> $issueWi.fields().severity().render().withIcon(true).htmlFor().forFrame() </li> #end</ol>"
The rest of adding a new column procedure is the same as it was before.
As a result, you'll get a list of Issue WIs sorted by their ID and the Severity column with the related values.
If you don't know how to configure an up-stream column to show multiple linked Work Items, please check the following link: click here
If anything is unclear or you have other questions feel free to contact us at [email protected]
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article