Allow linking upstream items to the Risk based on a specific condition

Modified on Fri, 15 Mar 2024 at 01:33 PM

You can decide that it is needed to link the upstream item depending on a Risk custom field value.

You can achieve it using the "cellDecorators" Risksheet functionality.



Example:


We have a Risk item with a custom field "Link Hazards? Yes/No" and depending on its value the system should allow or not allow to link Hazards to the Risk on the Risksheet.




To do so, we add the following function into the "cellDecorators" section:

...
"cellDecorators": {
"hazard": "function(info){if(info.item.loadHazard!=='yes'){ info.item.systemReadOnlyFields=info.item.systemReadOnlyFields+'|hazard|';$(info.cell).toggleClass('creadonly',true);}}"
}
...

This function checks if the value in the cell is not 'yes' and if so makes the cell read-only. 

'loadHazard' is an ID for the column 'Link Hazards? Yes/No' and 'hazard' is a Work item ID we are linking to the Risk.



Then we refer to this cell decorator in the Hazard column:

..
 "header": "Potential Failure Mode",
      "type": "itemLink",
      "id": "hazard",
      "cellRenderer":"hazard",
...

As a result, only Risk items that have a "Link Hazards" YES value can be linked on the Risksheet. Other cells will be marked as read-only.






 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article