# Working with Action Groups

### How to create Action Group <a href="#switch_to_actions_subtab" id="switch_to_actions_subtab"></a>

Go to the Action Group tab and click "**New**" button:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2F6e4BTz4yoBBNSjlvzXyi%2Ffile.excalidraw.svg?alt=media&#x26;token=f17c0f52-c811-4ee1-a024-5e8cf56cf726" alt="" class="gitbook-drawing">

"**New Action Group**" page will be shown:

* Enter the **Name** of new Action group.
* Set if it is necessary to **Track History** - when checked, you will be able see the history of action(s) execution.
* Enter **Description** if needed. &#x20;

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2F832aOQZlY7wcvFArPHoW%2Ffile.excalidraw.svg?alt=media&#x26;token=4fa387a3-edb8-4b44-b8c4-25c8aef592c3" alt="" class="gitbook-drawing">

Save. After this an Action Group Details tab will be shown:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FjQu7811rw6x4BhZujdZo%2Ffile.excalidraw.svg?alt=media&#x26;token=8cbc3646-97df-4cbc-99e5-29537b5ead48" alt="" class="gitbook-drawing">

### How to edit Action Group <a href="#how-to-edit-action-group" id="how-to-edit-action-group"></a>

Click "**Edit**" on Action Group View on it's details (see image above). You can also rename group if select "**Edit**" from list drop-down at the proper entry on groups list: &#x20;

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FdUOdI8svt7MHxDbFDmiU%2Ffile.excalidraw.svg?alt=media&#x26;token=d18f764a-cf8f-4900-9888-c8fc6c89d78a" alt="" class="gitbook-drawing">

### Working with Details Tab <a href="#working-with-details-tab" id="working-with-details-tab"></a>

**Share, Execute, Execute in batch, Execute on Schedule, Execute on Schedule in Batch Buttons**  in Action Groups work the same way as for Actions.

See more details at [Working with existing Action](https://docs.flexikanban.ai/components/actions-action-groups/working-with-actions#working-with-existing-action).

**Here are some specific details for action groups:**&#x20;

{% hint style="info" %}
**Execute, Execute on Schedule**

If you are working with action group with different types of source object you can pass sources as JSON Array which contains sources for each action from your Action Group.&#x20;

There are 2 ways you can pass sources:

***Option 1:*** Pass Action ids with record Id for each action

<mark style="color:red;">`"{Action1_ID}":"{record1_Id}", "{Action2_ID}":"{record2_Id}",...`</mark>&#x20;

***Option 2:*** Pass Object Name and Record Id. All Actions which use specified object as a source will use specified record Id

<mark style="color:red;">`"{Object1_API_Name}":"record1_Id",`</mark> &#x20;

<mark style="color:red;">`"{Object2_API_Name}":"record2_Id",...`</mark>

For example if there are 4 actions in the group, 3 of them use Account as Source object and 1 - Contact and you pass: <mark style="color:red;">`"Account":"{Account.Id}", "Contact":"{Contact.Id}"`</mark>`,`3 actions will get the Account.Id as source and 1 - Contact.Id
{% endhint %}

{% hint style="info" %}
**Execute in Batch, Execute on Schedule in Batch**

Execute in Batch can't be applied to the Group of Actions with different Source objects. It can work with one type of  source object or if source object is not specified since the context record always will be queried object type.
{% endhint %}

**Execute, Execute on Schedule**

You can attach a file to the action (e.g., some descriptive document or image).

Click **"Attach File" button** and follow the instructions on the page shown.

### Working with Actions Tab <a href="#working-with-actions-tab" id="working-with-actions-tab"></a>

* **Adding existing action to the Action Group.**

Click "**Add Action**" button and Actions tree will be shown in the popup. Choose necessary from the list of existing actions:

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FZonWejfItNq5DgmY7Jyn%2Ffile.excalidraw.svg?alt=media&#x26;token=1635b597-b669-423d-ae31-e56e38776f07" alt="" class="gitbook-drawing">

&#x20;

* Adding new action to the action group is the same as adding new action on "**Actions**" tab.

Click "**New Action**" and refer the article [How to create Action](https://docs.flexikanban.ai/components/actions-action-groups/working-with-actions#how-to-create-action) to fill in New Action inputs.

* Actions in the group will be executed in the specified order (upper first). To change order of actions use "**Up**" and "**Down**" links.
* Clicking "**Deactivate**" link user can exclude any action from execution in the current Action Group.&#x20;

### Working with History Tab <a href="#working-with-history-tab" id="working-with-history-tab"></a>

History tab will show the history of execution of the Action Group if the Track History selected on Action Group properties.

<img src="https://3097383375-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FK2dgObBO5ydOH2ZXDJLa%2Fuploads%2FaTp5vaduo4ARzFz4m2V2%2Ffile.excalidraw.svg?alt=media&#x26;token=f94548db-8814-4cdb-890d-cb982bd37327" alt="" class="gitbook-drawing">

Click **View** link to see details on each action execution:

<figure><img src="https://media.screensteps.com/image_assets/assets/007/082/740/original/80681db3-621e-48cf-960f-eb176c250680.png" alt=""><figcaption></figcaption></figure>

* **"Source"** cell can contain link to the record for which Action Group ran (if exists).
* **Variables** shows values assigned to the actions from the group.

### Using Variables in Actions in the Group <a href="#using-variables-in-actions-in-the-group" id="using-variables-in-actions-in-the-group"></a>

Action Group, as far as single Action, can have some parameters. In terms of Action Group, parameters can be passed as standard Variables.

The main advantages of Action Group Variables are:

* Variables that are passed as parameters, or defined in some Action in the Group, are available in subsequent Actions.
* These Variables can be changed in the Group with actions of "Define Variable" type.

**For example**, assume user needs to auto-combine email notification. This can be done with the following way:

1. E.g., user needs to send emails where some person name should be highlighted with given color in all places it appeared.
2. User triggers an Action Group (e.g., by clicking a button on some form) and passes current record creator's ID to this Group as parameter (variable): person = <mark style="color:red;">`{$SomeObject.SomeUser.Name}`</mark> and <mark style="color:red;">`color="purple"`</mark>.
3. first action receives this parameter and updates this variable: <mark style="color:red;">`person = <span style="background-color:{$Variables.color}; font-weight:bold;padding: 0 0.25em;">{$Variables.person}</span>`</mark> .
4. second action receives this updated <mark style="color:red;">`person`</mark> variable and sends email with some text, like this:

{% code fullWidth="true" %}

```
Dear {$Variables.person}, 
We're glad to inform you, that your account "{$Variables.person}" has been upgraded to <b>Pro+</b> plan.
...
Please consult with our online advisors in case of any questions. Type "\" with your account name "{$Variables.person}" in the chat bot message field to get quick assistance.
...
```

{% endcode %}

5\. In the letter sent all person names will be highlighted.
