# Scripting - Get default provider from a specific project

**URL:** <https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [May 3, 2023, 1:08pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197 "2023-05-03T13:08:27Z")\
**Posts on this page:** 9\
**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:** [May 3, 2023, 1:08pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/1 "2023-05-03T13:08:27Z")

</div>

Is there a way to get the default provider of a project.

I want to be abale to get the provider for a specific project then export it to json file.

---

<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:** [May 3, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/2 "2023-05-03T15:34:33Z")

</div>

There might be a better way to do this I'm not thinking of, but one option would be to rely on the script context threadlocal:

> [@\[BUG-5802\]Async Tag Event Script loses reference paths](https://forum.inductiveautomation.com/t/bug-5802-async-tag-event-script-loses-reference-paths/57768/3):
>
> I think you might be able to extract what you want from the current thread, then set it in the new thread via ScriptContext: [ScriptContext](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.15/com/inductiveautomation/ignition/common/script/ScriptContext.html)

This will obviously only work in scenarios where we actually know the project and therefore default provider to provide it before your script runs.

---

<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:** [May 3, 2023, 4:48pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/3 "2023-05-03T16:48:25Z")

</div>

> [@paul-griffith](#):
>
> There might be a better way to do this I'm not thinking of, but one option would be to rely on the script context threadlocal

What I want is to get the default provider name configured in a specific project, I want to be able to do an system.tag.exportTags(tagPaths = [default provider]) and I only know the project name.

---

<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:** [May 3, 2023, 5:13pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/4 "2023-05-03T17:13:03Z")

</div>

No easy way to do that, unfortunately. You'd have to retrieve the 'GlobalProps' resource per-project and look inside it for the default datasource.

---

<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:** [May 3, 2023, 6:01pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/5 "2023-05-03T18:01:52Z")

</div>

> [@paul-griffith](#):
>
> GlobalProps

'GlobalProps' is a built-in object accessible by a function or it's thru the system files?

---

<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:** [May 3, 2023, 6:07pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/6 "2023-05-03T18:07:57Z")

</div>

GlobalProps is a class that holds...global props 😄  
[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/project/GlobalProps.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/project/GlobalProps.html)

You obtain an instance of the class by deserializing the project resource, e.g. with ResourceUtil:  
[https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/util/ResourceUtil.html](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/util/ResourceUtil.html)

You obtain a ProjectResource from the project system; how you do that depends on what scope you're calling this from. [Ignition Extensions](https://forum.inductiveautomation.com/t/ignition-extensions-convenience-utilities-for-advanced-users/64615) can help with that.

---

<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:** [May 3, 2023, 6:21pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/7 "2023-05-03T18:21:24Z")

</div>

> [@paul-griffith](#):
>
> No easy way to do that, unfortunately.

I figure better your comment "No easy way to do that, unfortunately."

If you have a script example it will help me, i'm not so familiary by using class

---

<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:** [May 4, 2023, 1:43pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/8 "2023-05-04T13:43:02Z")

</div>

Is there an easy way to get the project title ?

---

<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:** [May 4, 2023, 3:59pm UTC](https://forum.inductiveautomation.com/t/scripting-get-default-provider-from-a-specific-project/73197/9 "2023-05-04T15:59:54Z")

</div>

From a gateway context (search the forum) you can retrieve the project manager.  
From the project manager, you can call [`getProject(name)`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/gateway/project/ProjectManagerBase.html#getProject(java.lang.String)) which returns an `Optional<Project> `; so you'd use a snippet like: `context.projectManager.getProject(name).get()` to receive an unwrapped `RuntimeProject`.  
`RuntimeProject` has a [`getManifest()`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/project/RuntimeProject.html#getManifest()) method, and the `ProjectManifest` has a [`getTitle()`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/project/ProjectManifest.html#getTitle()) method.
