# st.doForPeople

This action allows you to apply the actions specified in its `then` parameter to each person provided by the parent action.

> There is a limit of 20 people that this action can be applied to. If the parent action provides more than 20 people, only the first 20 will be processed.

## Constraints

> ⏺️ **Root Start:** not allowed.

> ⬆️ **Parent Actions:** [st.searchPeople](/docs/action-st-search-people), [st.retrieveCompanyEmployees](/docs/action-st-retrieve-company-employees), [st.retrieveCompanyDMs](/docs/action-st-retrieve-company-dms).

> ⬇️ **Child Actions:** [st.openPersonPage](/docs/account-api/action-st-open-person-page).

## Parameters

```json
{
  "actionType": "st.doForPeople",
  "then": { ... }
}
```

- `then` – object or array of child actions to apply to each person from the parent action.

## Result options

This action doesn't produce its own distinct result. The effects are visible in the people that were involved, as they will contain a `then` field with the results of the applied actions. See usage examples for more details.

## Usage examples

1. **Retrieving basic information about the first 2 people from the search results:**

**Workflow:**

```json
{
  "actionType": "st.searchPeople",
  "term": "John Doe",
  "limit": 2,
  "filter": {
    "position": "CEO",
    "locations": ["New York", "San Francisco", "London"]
  },
  "then": {
    "actionType": "st.doForPeople",
    "then": {
      "actionType": "st.openPersonPage",
      "basicInfo": true
    }
  }
}
```

**Completion:**

```json
{
  "actionType": "st.searchPeople",
  "success": true,
  "data": [
    {
      "name": "John Doe",
      "publicUrl": "https://www.linkedin.com/in/johndoe",
      "headline": "Software Engineer at TechCorp",
      "location": "San Francisco, USA",
      "then": {
        "actionType": "st.openPersonPage",
        "success": true,
        "data": {
          "name": "John Doe",
          "publicUrl": "https://www.linkedin.com/in/johndoe",
          "hashedUrl": "https://www.linkedin.com/in/SInQBmjJ015eLr8",
          "headline": "Software Engineer at TechCorp",
          "location": "San Francisco, USA",
          "countryCode": "US",
          "position": "Software Engineer",
          "companyName": "TechCorp",
          "companyHashedUrl": "https://www.linkedin.com/company/12345678"
        }
      }
    },
    {
      "name": "John Doe",
      "publicUrl": "https://www.linkedin.com/in/johnyde",
      "headline": "Product Manager at TechCorp",
      "location": "New York, USA",
      "then": {
        "actionType": "st.openPersonPage",
        "success": true,
        "data": {
          "name": "John Doe",
          "publicUrl": "https://www.linkedin.com/in/johnyd",
          "hashedUrl": "https://www.linkedin.com/in/Hs763KsjdB153e",
          "headline": "Product Manager at TechCorp",
          "location": "New York, USA",
          "countryCode": "US",
          "position": "Product Manager",
          "companyName": "TechCorp",
          "companyHashedUrl": "https://www.linkedin.com/company/12345678"
        }
      }
    }
  ]
}
```

2. **Sending connection requests to all the company's decision makers:**

**Workflow:**

```json
{
  "actionType": "st.openCompanyPage",
  "companyUrl": "https://www.linkedin.com/company/techcorp",
  "then": {
    "actionType": "st.retrieveCompanyDMs",
    "then": {
      "actionType": "st.doForPeople",
      "then": {
        "actionType": "st.openPersonPage",
        "then": {
          "actionType": "st.sendConnectionRequest"
        }
      }
    }
  }
}
```

**Completion:**

```json
{
  "actionType": "st.openCompanyPage",
  "success": true,
  "data": {
    "then": {
      "actionType": "st.retrieveCompanyDMs",
      "success": true,
      "data": [
        {
          "name": "John Doe",
          "publicUrl": "https://www.linkedin.com/in/johndoe",
          "headline": "CEO at TechCorp",
          "location": "New York, USA",
          "then": {
            "actionType": "st.openPersonPage",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.sendConnectionRequest",
                "success": true
              }
            }
          }
        },
        {
          "name": "CTO Smith",
          "publicUrl": "https://www.linkedin.com/in/janesmith",
          "headline": "Software Engineer at TechCorp",
          "location": "San Francisco, USA",
          "then": {
            "actionType": "st.openPersonPage",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.sendConnectionRequest",
                "success": true
              }
            }
          }
        }
      ]
    }
  }
}
```
