---
title: "Compare two fields with custom JQL"
canonical: "https://support.appfire.com/space/PSJ/15482431/Compare%20two%20fields%20with%20custom%20JQL"
format: markdown
---
> Macro (aura-html)


The script identifies issues where the custom field (second parameter) does not have the same value as the corresponding epic.

### Script

```
string [] epics = selectIssues(argv[0]);
string matchField = argv[1];
string [] ret;
 
for(string e in epics) {
    for(string i in allLinkedIssues(e, "Epic-Story Link")) {
        
        if(%i%.%matchField% != %e%.%matchField%) {
            ret += i;
        }
    }
}
 
return ret;
```

## Implementation steps

1. Create the SIL script using the code above.
2. Save the script as `silJql_FieldValueDosentMatchEpic.sil` or another name.
3. Use the script in JQL queries by calling it with the appropriate parameters.

## Example usage

This JQL query finds all stories in project EX where the Team field doesn't match the Team field of their parent epic.

```
key in silJQLList("silJql_FieldValueDosentMatchEpic.sil", "Project = EX and type = Epic", "Team")
```

> ℹ️ The filename in the JQL query (`"silJql_FieldValueDosentMatchEpic.sil"`) must match the exact name you used when saving the SIL script in the previous step.

### Parameters

- **First parameter**: JQL query to select epics (`"Project = EX and type = Epic"`).
- **Second parameter**: Name of the custom field to compare (`"Team"`).