# system.kanoa.quality.config.copyGroup(chkItemGroupId, chkItemGroupName, userId)

Copies a check item group, with its check items and their images, attribute links and data source tags, as a new group at the end of the same check sheet. A trigger inside the group moves to its copy, and a calculation's references to the copied checks ('Group\Check') are renamed to the new group; triggers and references to other groups are kept.

---

### Parameters

**chkItemGroupId** `Integer`: Id of the group to copy<br />

**chkItemGroupName** `String`: Name of the new group. None names it after the group's next free number, e.g. 'Main' to 'Main 2'. A name the check sheet already has is refused<br />

**userId** `Integer`: Id of the user executing the function<br />

---

### Returns

**(chkItemGroupId, msg)**: the new group's id and None, or None and the reason nothing was copied<br />

---

### Example

```python
#Copy the 'Stage 1 - Clean' tab of check sheet 56 as 'Stage 1 - Clean 2'
groups = system.kanoa.utilities.convertDatasetToJSON(system.kanoa.quality.config.getGroups({'chkShtId': 56}))
chkItemGroupId = [g['chkItemGroupId'] for g in groups if g['chkItemGroupName'] == 'Stage 1 - Clean'][0]
userId = 5
newGroupId, msg = system.kanoa.quality.config.copyGroup(chkItemGroupId, None, userId)
if msg: system.kanoa.toast.show({'type': 'error', 'message': msg})
```
