---
title: "WSJF scripted field"
canonical: "https://support.appfire.com/space/PSJC/854327387/WSJF%20scripted%20field"
format: markdown
---
> Macro (aura-html)


## Problem

You would like to display the outcome of the [Weight Shortest Job First](https://scaledagileframework.com/wsjf/) equation in a Jira field.

## Example WSJF Calculation

Weighted Shortest Job First (WSJF) is a prioritization model used to sequence work for maximum economic benefit. In SAFe, WSJF is estimated as the relative cost of delay divided by the relative job duration.

![Power Scripts Weighted Shortest Job First (WSJF) prioritization model](media://eaf68ee9-e11d-4bc1-b0f2-6c81f8544cb1)

The actual calculation and prioritization are more straightforward than the explanation that brings us to this point. Compare jobs (three features, in this example) for each CoD component and job size using a simple table or spreadsheet (Figure 5). As with estimating stories, larger values reflect higher uncertainty.

![Power Scripts WSFJ job comparison for each CoD component and job size using a simple table or spreadsheet](media://802a91dc-8f72-448c-a5bc-3430ea89f3c0)

## Solution

This script assumes that there are custom fields for User Business Value, Time Criticality, Risk Reduction, and Job Size and that those fields also has [SIL aliases](https://appfire.atlassian.net/wiki/spaces/PSJC/pages/793280566) created for them.

```
if(isNotNull(userBusinessValue) && isNotNull(timeCriticality) && isNotNull(riskReduction) && isNotNull(jobSize)) {
    number costOfDelay = userBusinessValue + timeCriticality + riskReduction;
    return round(costOfDelay/jobSize, 2);
}
```


> ℹ️ Because all the fields used in the calculation are all contained in the issue, and not on a parent, child, or linked issue, **no additional triggers** settings are needed for the [scripted fields configuration](https://appfire.atlassian.net/wiki/spaces/PSJC/pages/856361791).