# Custom Import Tag Functionality for a ManagedTagProvider

**URL:** <https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323>\
**Category:** Module Development\
**Created:** [December 9, 2020, 4:35am UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323 "2020-12-09T04:35:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nicholas](https://forum.inductiveautomation.com/u/nicholas)\
**Post date:** [December 9, 2020, 4:35am UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323/1 "2020-12-09T04:35:10Z")

</div>

Does anyone know how to go about tying in a custom tag import function for a ManagedTagProvider?

The plan is to make an RPC client function get a json file and root folder from the user and then pass it to the gateway which then interprets the json and creates tags with ManagedTagProvider configure(). This functionality would ideally work for both the tag browser `Import Tags` dropdown option in the Designer and also for the system.tag.importTags function. How do I go about making this happen?

This looks like what I want, but I’m not sure how to use it:  
[ImportTagAction SDK Docs](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/designer/tags/tree/action/ImportTagAction.html#handleImport(com.inductiveautomation.ignition.client.tags.tree.node.BrowseTreeNode))  
The ManagedTagProvider does not seem to have an import function to override.  
[ManagedTagProvider SDK Docs](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/gateway/tags/managed/ManagedTagProvider.html)

Thanks

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 9, 2020, 4:15pm UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323/2 "2020-12-09T16:15:27Z")

</div>

ManagedTag are created in the gateway scope with the ManagedTagProvider class.  
Create a New provider and then configure new tags and then update the value and listen for writes if the tags have to be writable.

Your module has to create the managed tags

---

<div class="post-metadata">

**Author:** ![nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nicholas](https://forum.inductiveautomation.com/u/nicholas)\
**Post date:** [December 9, 2020, 7:13pm UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323/3 "2020-12-09T19:13:22Z")

</div>

I do already have the module making tags and writing to them, etc. They are special tags that have different functionality that the module gives them. But I would like for the user to be able to create tags also via tag import. Is this not possible?

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [December 9, 2020, 7:20pm UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323/4 "2020-12-09T19:20:36Z")

</div>

in that case, your module has to provide a script function which receive a file.  
You’ll have to parse the file and create tag.  
Other tags created in the desigenr are not managed tag.

---

<div class="post-metadata">

**Author:** ![nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nicholas](https://forum.inductiveautomation.com/u/nicholas)\
**Post date:** [December 9, 2020, 7:25pm UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323/5 "2020-12-09T19:25:20Z")

</div>

Alright, that seems reasonable. Is it possible for that script function to be called by right clikcing on the tag provider in the designer and clicking `Import Tags` like this?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/a/ba1d3828e201d809e56c5fcd053aca330a673414.png)

---

<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:** [December 9, 2020, 7:51pm UTC](https://forum.inductiveautomation.com/t/custom-import-tag-functionality-for-a-managedtagprovider/41323/6 "2020-12-09T19:51:02Z")

</div>

It doesn’t look like there’s any very exposed way to implement your own import code when using `ManagedTagProvider` - which would be the only way to really tie it into the UI/scripting functions.

You would need to override `importTagsAsync` on the `TagProvider` interface, but `ManagedTagProvider` (by design) doesn’t actually extend or relate to that base interface. Instead, `ManagedTagProviderImpl` creates a package-private `ManagedProviderRuntime internalProv`, and that’s what actually implements `importTagsAsync`. If you want tight integration with the UI, you’d either have to create your own `internalProv` instance (it looks like you could do so by overriding `setup()` without calling the super method, but be careful) or implement the whole `TagProvider` interface yourself and ditch the `ManagedTagProvider` abstraction.
