Issue attaching Attachments via Workbench

Followup to this post: Renaming base tables and changing icon:

Now that I’ve renamed our base table and have the fields and forms set up how I’d like them, I’ve been trying to get data uploaded into the newly renamed tables. I keep running into this error:

Error occurred during Validation

{
  "uploaderstatus": {
    "operation": "validating",
    "taskid": "d13848b2-9c55-4672-acd6-ce3d48f82eeb"
  },
  "taskstatus": "FAILURE",
  "taskinfo": "FieldDoesNotExist(\"Fieldnotebookpage has no field named 'fieldnotebookpageattachments'\")"
}

I’ve tried renaming the caption of fieldnotebookpageattachments to literally be “fieldnotebookpageattachments” and signing out and back in, but have had no luck.
I’ve added the upload plan below, we’re running 7.11.2.
Attachments.tsv (668.0 KB)

Edit: can confirm that this issue does not appear to have to do with me renaming the base table. Same error occurs on the test server: https://sp7demofish.specifycloud.org/specify/workbench/3/

Hi @nfshoobs,

Thank you for your report! Upon investigating, I found that the WorkBench is incorrectly looking for the data model field fieldnotebookpageattachments when it does not exist (instead, the field is named attachments). The caption assigned to it in the Schema Config is not taken into account. I described this for our developers here:

This means that WorkBench Attachments are not supported for the following tables until a fix is pushed:

  • Field Notebook
  • Field Notebook Page
  • Field Notebook Page Set
  • DNA Sequence
  • DNA Sequencing Run
  • Attachment Image Attribute

I have raised this with our development team to discuss in an upcoming meeting! I appreciate you taking the time to share this with us!

1 Like

Reassuring that it isn’t a problem with our configuration or my mapping, but also a bit frustrating because this means that both parts of dealing with the problem I mentioned in my prior post (both Deleting collectionobjectattachment via api endpoints and creating thousands of new attachments) are blocked until these errors get fixed in the next version. Since I can’t use batch edit to change ‘id’, I also can’t work around it by just changing the table that the existing attachments are attached to.

Is there a decent way to do this by directly manipulating the SQL? Would appreciate assistance in getting this done soon, as it is blocking me uploading a bunch of other new data into the CO attachment table.

Hi @nfshoobs,

If you want to perform a mass import of attachments and have access to the asset server backend, you can:

  1. Add the attachments directly to the configured attachments/originals directory for the Asset Server. You can model this off other attachments already present in the directory and on the asset server!

  2. Create a corresponding attachment record using SQL for each asset in the database, setting the attachmentLocation field in each record to the file name in the attachments/originals directory.

  3. Create a collectionobjectattachment record with the appropriate CollectionMemberID, AttachmentID, and CollectionObjectID, linking the new attachment record to the correct collectionobject. You will likely want to include an identifier to match in step 2, allowing you to easily link the correct records!

This process can be automated using a script, allowing you to complete it entirely outside of the main interface and without the use of the APIs.

For some more information about how Specify talks to the asset server, you can read this doc here:

You don’t need to generate the thumbnails manually as they are created dynamically when viewed in Specify 7!

Hey Grant,
Thanks for this! I do have access to the asset server (well, I don’t directly, but my colleague who runs the servers in IT does and is happy to run stuff like this).
Do you or the other devs happen to have a script for a similar task that we can use as a cheatsheet? We’ve experimented a bit with making edits to assets on the asset server in the backend and have found it a bit counterintuitive.

For inputs, I have two CSV files: the first has the unique filenames for the attachments files I want to upload (about 2700 images), and their desired attachment title and ‘page number’ values (page number being the primary key for the fieldnotebookpage table).
The other csv has all ~67,000 IDs of CO records and the ‘page number’ they should link to, many-to-one.

Would you recommend trying to do all of this manually on the server and DB, or should we just create the assets there and then use the frontend (workbench or batch edit) to create links between COs and the newly created fieldnotebookpage records? Edit: reread step 3 of your original reply and realize that you addressed this part.

Hi @nfshoobs,

I added a high-level guide on how the process should look:

Can you take a look at this and let me know if it helps clear up the process some more?

Exactly what I was looking for. I’ll let you know how it goes!
Note: I marked this solved, but feel free to undo that if you prefer since the root issue is still unfixed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.