Risksheet Custom Context Menu Actions

Modified on Wed, 23 Jul at 3:06 PM

This customization adds a new context menu action called "Open in Diagram" to every item link and task link column in Risksheet. When right-clicking on a relevant cell, users will be able to quickly open the linked item directly in Polarion’s diagram or work item view.




TABLE OF CONTENTS


Configuration

Put the following script in the risksheet_topPanel.vm file. 

If you aren't familiar with how to work with this file, please check the article on this topic here.

<script>
risksheet.customContextMenuActions ={
  "openInDiagramAction":{
      "label":"Open in Diagram", 
      "function":"openInDiagram", 
      "isEnabledFunction":"isOpenInDiagramEnabled"
      }  
  };


function isOpenInDiagramEnabled(item, col){
  console.log("isDoEnabled",item,col)
    return col.type==="itemLink" || col.type==="taskLink";
}


function openInDiagram(item,col){
  let project = risksheet.projectId;
  let linkId=item[col.id]; 
  if(col.type==="taskLink" && linkId.indexOf('!')!=-1){
    const idArray = linkId.split('!');
    project =  idArray[0];
    linkId = idArray[1];
  }
  //replace with real diagram url ....
  window.open(`/polarion/#/project/${project}/workitem?id=${linkId}`)
}

</script>

For any assistance, please don’t hesitate to reach out by submitting a ticket here.

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 at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article