# \[Feature-2684\]Scripting - Tag group - Create / Delete

**URL:** <https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [June 1, 2021, 11:51am UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293 "2021-06-01T11:51:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 1, 2021, 11:51am UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/1 "2021-06-01T11:51:32Z")

</div>

8.1.5

I don’t find any exemple to manage, create, delete tag group with scripting.

Is there a way to do that ?

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [June 1, 2021, 2:19pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/2 "2021-06-01T14:19:30Z")

</div>

Hi @luc.martin, I don’t think it is possible, but I’ve never looked into it too deeply so 🤷‍♂️

Just out of interest why would you need to manage tag groups in this way? Could be worth a feature request.

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [June 1, 2021, 2:32pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/3 "2021-06-01T14:32:20Z")

</div>

There is a series of commands to do that.  
system.tag.\*  
has commands to create (add in 7.9.x/configure in 8.x), edit, delete, organize, retrieve.  
Everything I’ve ever needed is already there.

---

<div class="post-metadata">

**Author:** ![luc.martin](https://avatars.discourse-cdn.com/v4/letter/l/77aa72/32.png) [@luc.martin](https://forum.inductiveautomation.com/u/luc.martin)\
**Post date:** [June 1, 2021, 2:33pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/4 "2021-06-01T14:33:26Z")

</div>

I use scripting to manage, create and delete my UDTs, so I want to validate if tag group exist and configured correctly when I plublish an update.

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [June 1, 2021, 2:41pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/5 "2021-06-01T14:41:16Z")

</div>

Unfortunately there doesn’t seem to be anything for manipulating tag groups there. Those set of functions only seem to encompass tag manipulation (as far as I can see).

---

<div class="post-metadata">

**Author:** ![matthew.ayre](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew.ayre/32/19499_2.png) [@matthew.ayre](https://forum.inductiveautomation.com/u/matthew.ayre)\
**Post date:** [June 1, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/6 "2021-06-01T14:43:23Z")

</div>

That makes sense and it could be quite useful. If you don’t get an answer definitely look into making a feature request.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 1, 2021, 2:45pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/7 "2021-06-01T14:45:59Z")

</div>

I was about to say to put it in the ideas portal. 🙂

I thought there was already one there, but I don’t see it.

> **[Inductive Automation Feedback](https://ideas.inductiveautomation.com/)**
>
> Give feedback to the Inductive Automation team so we can make more informed product decisions. Powered by Canny.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 1, 2021, 4:55pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/8 "2021-06-01T16:55:43Z")

</div>

You’re not missing anything, but yes, this should definitely be possible.

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [June 4, 2021, 5:15pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/9 "2021-06-04T17:15:25Z")

</div>

On a related note, do any of you know if there currently is a way to retrieve a list of existing tag groups via scripting?

---

<div class="post-metadata">

**Author:** ![weixionglichina](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weixionglichina/32/10650_2.png) [@weixionglichina](https://forum.inductiveautomation.com/u/weixionglichina)\
**Post date:** [October 8, 2021, 8:18am UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/10 "2021-10-08T08:18:53Z")

</div>

How is going this feature?

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [October 18, 2021, 10:37am UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/11 "2021-10-18T10:37:36Z")

</div>

> [@swolnisty](#):
>
> On a related note, do any of you know if there currently is a way to retrieve a list of existing tag groups via scripting?

I just came to a situation when this would be a very useful feature...

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 18, 2021, 2:35pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/12 "2021-10-18T14:35:19Z")

</div>

this will get you a list of all the tags of the given provider (this case default)

```auto
from com.inductiveautomation.ignition.gateway import IgnitionGateway
provider = IgnitionGateway.get().getTagManager().getTagProvider('default')
taggroups = provider.getTagGroupsAsync().get()
names = [x.getName() for x in taggroups]

```

there is also `saveTagGroupsAsync()` and `removeTagGroupsAsync()`  
[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/common/tags/model/TagProvider.html#getTagGroupsAsync()](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/common/tags/model/TagProvider.html#getTagGroupsAsync())

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [October 18, 2021, 2:42pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/13 "2021-10-18T14:42:33Z")

</div>

Thank you, but this is what I get (v8.1.10):

 ![Screenshot_21](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/7/8781334018b3f174cf761d7237c26a3897b6429a.png)

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [October 18, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/14 "2021-10-18T14:43:05Z")

</div>

you can not use this in the script console

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d59f1924ab5e43f46c77bf33b79cb99dcc717c5f.png)

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [October 18, 2021, 2:47pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/15 "2021-10-18T14:47:46Z")

</div>

OK, thank you, but I need this in Vision, not Perspective…

 ![Screenshot_22](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/8/58e2d773819cf770152a8617d20bc90afa732b49.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 18, 2021, 2:50pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/16 "2021-10-18T14:50:21Z")

</div>

> [@zxcslo](#):
>
> OK, thank you, but I need this in Vision, not Perspective…

Send a message to a message handler.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [October 18, 2021, 2:52pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/17 "2021-10-18T14:52:22Z")

</div>

Ok, but from where?  
Sorry but … I’m 😕

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 18, 2021, 2:54pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/18 "2021-10-18T14:54:10Z")

</div>

Wherever you needed it in Vision?

Define a gateway message handler in your project that will run @victordcq’s gateway-scoped code. Call that message handler from anywhere in Vision Client scope using `system.util.sendMessage` or `sendRequest`.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [October 18, 2021, 2:57pm UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/19 "2021-10-18T14:57:23Z")

</div>

> [@Kevin.Herron](#):
>
> gateway-scoped code

Now I understand.  
Thank you. 👍

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 15, 2022, 12:45am UTC](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293/20 "2022-08-15T00:45:59Z")

</div>

> [@victordcq](#):
>
> ```auto
> from com.inductiveautomation.ignition.gateway import IgnitionGateway
> provider = IgnitionGateway.get().getTagManager().getTagProvider('default')
> taggroups = provider.getTagGroupsAsync().get()
> names = [x.getName() for x in taggroups]
> 
> ```

Is this the only way (or at least the best/easiest way) to get a list of tag groups?

[Next page](https://forum.inductiveautomation.com/t/feature-2684-scripting-tag-group-create-delete/47293.md?page=2)
