Use Shotgun query folder for Project entity in schema

Hello,

Is it possible to have a Project entity query folder with its name field set to ‘sg_project_number’ under the main root folder?

Here is the sg_project_number.yml I wrote.

type: "shotgun_entity"

entity_type: Project

name: "sg_project_number"

filters:
- {"path": "project", "relation", "is", "values": ["$project"]}

field_name: "sg_project_number"

As a result with the yml, the Shotgun desktop console caught KeyError: ‘project’ as it tried to get a value by “value = rec[field]” from tk-core\python\tank\folder\folder_types\entity.py.

It would be great if anyone knows there is a proper solution or workaround on this.

Thanks

3 Likes

Hi @keikun welcome to the forums!

Unfortunately, I don’t believe this is possible.
The project root folder must always use the tank_name field value from the Shotgun Project entity. And you can’t make an entity folder that is a project type.

There are a couple of things you can do, I’m not sure if they would help in your situation.

  1. The tank_name value can contain path separators if you want to have a nested project root, e.g. project_code/project_name.
  2. You can add the project folder as part of a different entity folder, using this technique. For example you could get a project folder created when creating an asset folder using name: "{project.Project.sg_project_number}/{code}". However, you would still be required to have the project folder at the root based on the tank_name value, as well.
2 Likes

Thank you for your excellent workaround solution on this, @philip.scadding. Yes, containing path separators achieved what I need in the schema. Thank you!

2 Likes