Updating Custom Fields in SG Published Files Page


I have customized the SG Publish window in Maya to have two buttons for render range in and render range out. I updated the item class in tk-multi-publish2 and I am able to print the values of item.render_range_in and item.render_range_out correctly.
The question is: when publishing from Maya, how do I get these values updated in the custom fields “Render Range In” and “Render Range Out” in SG Published Files page (please see attached image)?


Hey @aitrdae—welcome to the community! Your question is better suited for the #pipeline category, so I’ve moved it over there so it gets the right eyes. :slight_smile:

Thank you

Hi @aitrdae

When you say you customized the Item class, did you actually modify the app, or did you just take over the collector hook and then add the property?

If you’re using the default publish plugin, then all you need to do is set the publish_fields property on the item I think, since this is pulled into the register_publish call.

This is where the default plugin would extract the value


1 Like

Thank you @philip.scadding

Yes, I did actually modify the tk-multi-publish2 app. I was looking for a way to modify the ui using hooks but could not find.

In def get_publish_fields(…
Is default_value a dictionary such as:
“Render Range In”:1,
“Render Range Out”:200

Where “Render Range In” is the name of the custom field in SG Published Files page?

1 Like

I have tried:

def get_publish_fields(self, settings, item):

        fields_dict = {
            "render_range_in" : "1",
            "render_range_out": "200"
        return item.get_property("publish_fields", fields_dict)

I am printing the values in

def publish …

and they seem to be correct:

{‘render_range_out’: ‘200’, ‘render_range_in’: ‘1’}
{‘comment’: u’Test 43’, ‘dependency_paths’: …
‘sg_fields’: {‘render_range_out’: ‘200’, ‘render_range_in’: ‘1’}, ‘thumbnail_path’: None, ‘path’: …

But I am getting the error:

ShotgunPublishError: Unable to complete publishing because of the following error: API create() PublishedFile.render_range_out doesn’t exist:
{“field_name”=>“render_range_out”, “value”=>“200”}.

Which I don’t understand

1 Like

You can modify the publish plugin UI, here is an example, but for anything else you would need to take over the app. However I would still make use of the item properties to store your settings as this will mean you then don’t need to modify the publish plugin at all, as it already looks for the publish_fields property.

From the error you are getting is looks like you are providing incorrect field names. They look like custom fields, so I would expect them to start with sg_ at least. I would check that you are providing the correct PublishedFile field names.


Thank you very muck @philip.scadding
It did work. I had to add “sg_” to custom field names.

If I have the same custom field names in shots. How will the Maya SG Publish can update shot custom field values as well?

1 Like

Hi Alaa –

You can use the Python API’s update() method to update fields on any entity in your Shotgun database.

1 Like

Thank you @tannaz. I will try this.

I am happy that the tool is working but I am still not sure how the variable "“sg_render_range_in” was mapped to custom field “Render Range In”. Obviously the “sg_” and all special characters are removed and it is not case sensitive.
Is there is a naming convention for custom fields for this mapping to work??


Hi @aitrdae – there’s not a procedural mapping between display names and API names for fields in Shotgun. If, on an Info page, you open “Configure important info”, you can see the API name by hovering your mouse over a field name in the list:

1 Like

Thank you again @tannaz