---
title: "Fetch the Component/s whose lead is a specific user"
canonical: "https://support.appfire.com/space/JMWE/461407073/Fetch%20the%20Component%2Fs%20whose%20lead%20is%20a%20specific%20user"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet fetches the Component/s whose lead is a specific user.

### Logic

Access the available options for the issue's Component/s, find all Component/s whose lead is the specific user and return them.

### Snippet 

```javascript
def components = issue.getAvailableOptions("components")
def newComponents = components.findAll{
  it?.getLead() == <ApplicationUser Object>
}
return newComponents
```

##### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<ApplicationUser Object`> | `The ApplicationUser object` | `currentUser()` |

### Context

The output of this snippet is a [Collection](http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html)`<`[ProjectComponent](https://appfire.atlassian.net/wiki/display/JMWE/ProjectComponent+interface)`>` which you can use in a Groovy expression for example, to set a Component/s field in:

- one of the Set Field Value post-functions
- the Create issue post-function under Set fields of new issue section

### References

- [issue interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78055921)
- [getAvailableOptions()](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/78053666)
- [ProjectComponent interface](https://appfire.atlassian.net/wiki/spaces/JMWE/pages/462062256)
- [**Groovy Documentation**](http://groovy.codehaus.org/User+Guide)

### Related articles

> Macro (contentbylabel)

> Macro (details)
> 
> | **Related issues** |  |
> | --- | --- |