Can't upload to specific field_name

Hi everyone !
I got a small problem with shotgun API and shotgun and I’m looking for help :wink:

Here the thing : I need to upload some pictures in two different fields of my Notes (entity).
Some of the pictures need to be uploaded in the attachments field of the note, no problem with that.

For that I do a
sg.upload(“Note”, note[‘id’], img)

Other pictures need to be uploaded in a custom field called sg_annotations, which is a File/link field type.

For that I do a
sg.upload(“Note”, note[‘id’], img_annotation, field_name=‘sg_annotations’)

And… Shotgun links my attachments to the attachments field and not to the sg_annotations field like I ask him.

Does someone have a clue ?


Hey @tristanlg,

Welcome to the community! What is the data-type of your sg_annotations field? You can only upload to a File/Link style field, and then you can only upload/reference a single File at a time in that field type.

Can you tell us a little bit more about the workflow you’re looking to build around these different fields? Would uploading to the stock “attachments” field work to store your annotations?

1 Like

Hi Brandon and thanks for your answer !

My sg_annotations field allows File/Link, and I upload only a single file at a time.
I need to separate my attachments and my sg_annotations because I need my users to only see the attachments when they look at the note in Shotgun, and my in-house tool to get only the pictures in my sg_annotations.

To get it clear, my attachments are jpg files of a 3d render of a scene + annotations picture.
My sg_annotations are png files of the annotations pictures.
This way my in-house tool allows my users to see previously made annotations in overlay (png files).

I found a workaround : creating an attachment (sg.create(‘Attachment’…), upload my png file to that attachment, update my note.sg_annotations with my attachments.

But I didn’t found a way to make the field_name attribute work on an upload on a note…