It's all about the answers!

Ask a question

Using a script to set a calculated priority value

Jeff Piontek (132) | asked Apr 29 '16, 1:08 p.m.
Hello, I am trying to set an attribute customization in rqm using a script.The script is supposed to get the input on a defect work item for the severity attribute and a custom risk attribute. The severity and priority enumerations and attributes in rqm have not been adjusted. The priority attribute should calculate is value using the logic in the script. I have been able to return the priority back out to my defect , and rqm shows the returned value in a query. However my dashboard widget is showing the literal priority categories instead of the high,medium,low enumerations.I think this might be an indexing issue.Any help is appreciated.

Here is the script:
 (function() {
    var WorkItemAttributes=;
    dojo.declare("com.example.Priority", null, {
    getValue: function(attribute, workItem, configuration) {
      //Output to log line break mostly just to break it up for viewing
     //Logs value for parameters entered in, note may have to adjust enumerations for priority to non read only to actually get a value
     //Priority is really only there for setting up the script, leave it commented out unless you need it   
            var risk = workItem.getLabel("risk");
            var severity = workItem.getLabel("internalSeverity");
            var priority = workItem.getLabel("internalPriority");
        catch (err){
          var txt;
          txt="Something went wrong";
          txt+=" You should fix that";
     // Comparison statements for Risk/severity values and set priority value, use log entry values from above for actual inputs and outputs, than return priority back to rqm
     // Using the values from priority above so that the conversion back into rqm is correct
       if (risk === 'High'   & severity === 'Minor'  ){
          internalPriority =  'priority.literal.l8';
        }else if (risk === 'High'  & severity === 'Major'  ){
          internalPriority = 'priority.literal.l9'  ;
        }else if (risk=== 'High'  & severity === 'Critical' ){
          internalPriority = 'priority.literal.l7'     ;
        }else if (risk === 'Low'  & severity === 'Minor'  ){
          internalPriority = 'priority.literal.l2'  ;
        }else if (risk === 'Low'  & severity === 'Major'  ){
          internalPriority = 'priority.literal.l8'   ;
          internalPriority = 'priority.literal.l9'  ;
        return internalPriority

Here is what the widget is showing.

Donald Nong commented May 06 '16, 1:30 a.m.

Re-post the attachment so that others can see.

One answer

permanent link
Antonio Napoles (2861) | answered May 04 '16, 5:59 p.m.
 Hi Jeff,

Which RQM version and which widget are you using?

Jeff Piontek commented May 05 '16, 7:47 a.m.

4.0.7, I was actually able to get this to work. ThanksĀ  anyways.

Donald Nong commented May 06 '16, 1:31 a.m.

For the benefit of the community, can you please let us what changes you have made to make it work?

Your answer

Register or to post your answer.