[Archivesspace_Users_Group] Including user defined fields in the PUI

Andrew Morrison andrew.morrison at bodleian.ox.ac.uk
Thu May 6 04:28:12 EDT 2021


The user-defined fields are in the JSON for objects that have them (e.g. 
resources), so you can display them with something like this:

<%= @result['json']['user_defined']['text_1'] %>

But shared templates like _record_innards.html.erb also render other 
objects which don't have user-defined fields (e.g. archival objects) so 
the above would error when displaying those. So you'll need to wrap that 
in something that uses the has_key? method.

In general, be aware that overriding _record_innards.html.erb has 
long-term maintenance implications. That is because it is often changed 
in ArchivesSpace releases, meaning someone will have to review and 
possibly re-implement you customizations when upgrading in the future.

Also, user defined fields aren't exported and don't appear in PDFs, so 
unless you also override those as well then they might not be suitable 
for essential information in the long term.

Andrew.


On 05/05/2021 21:32, Bhavin Tailor wrote:
> Hi all,
>
> This may (or may not) be simpler than a lot of the questions here. How 
> do you get a user_defined_field to display in the PUI ? I've gone 
> through the documentation and tried a number of things but I'm likely 
> missing a step along the way. I've modified the label for the admin 
> interface but just can't seem to get it to display in a resource 
> record on the public side. I've mostly been working in the 
> _record_innards.html.erb but have yet to have luck.
>
> Many thanks in advance,
> Bhavin
>
> -- 
> Bhavin Tailor
> Senior Web Developer
> Clemson University Libraries
> 864-656-6375
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20210506/bd4d6d42/attachment.html>


More information about the Archivesspace_Users_Group mailing list