Hi,
I’m having an issue with writing code that will recognise when an attachment is uploaded using the new feature - to ‘link an external document’. This is ultimately a hyperlink rather than a document.
The template in question recognises a schedule as ‘reconciled’ when there is a document attached. My gut feeling is that hyperlinks are either not recognised under the ‘file collection’, or under the file input (.documents) hence are not recognised in this code.
{% if custom.[category].attachment_na != true %}
{% if custom.check.locked %}
{% assign sf_show_inputs = true %}
{% if custom.[category].att.document != blank %}
{% input custom.[category].att as:file_collection %}
{% endif %}
{% assign sf_show_inputs = false %}
{%else%}
{% input custom.[category].att as:file_collection %}
{% endif %}
{% endif %}
|{% if custom.[category].attachment_na or custom.[category].att.document != blank %}
{% unreconciled 0 as:indicator %}
{%else%}
{% unreconciled 1 as:indicator %}
{% endif %}
I would be grateful for any indications on where the linked document is exposed to Liquid, and what fields are reliably present for a linked item (e.g. url / id / link).
Thanks,
Mike
Hi @Mike.davis
There is indeed a limitation here since an external link is not stored in the textproperties on the reconciliation text. It’s also not considered a document so none of the regular methods (like .documents.size or document.link) work for external links. I will however raise this issue internally to see if there’s anything that we can expose in liquid going forward.
If the goal is to have the template be unreconciled when nothing is attached, I would recommend making use of the `required`attribute.
{% input custom.[category].att as:file_collection required:true %}
You can also pass a variable that is only true in certain situations, so the file input does not have to always be required.
{% assign att_is_required = false %}
{% if custom.[category].attachment_na == true %}
{% assign att_is_required = true %}
{% endif %}
{% input custom.[category].att as:file_collection required:att_is_required %}
I hope that covers the use case you are currently looking at.
Kind regards
Romy
Hi Romy,
Thanks for confirming and for your suggestions, unfortunately the ‘required’ attribute will not work as a fix for my use case as I would still prefer the reconciled symbol displayed for each row rather than contributing to the reconciliation status of the whole template, but I have found another suitable work around.
If you are able to expose it in liquid at some point in the future that would be great, but no worries if not!
Thanks,
Mike
Hi @Mike.davis
Glad to read you found a suitable workaround.
This feature with external links has not been released to all the users of Silverfin yet, so our documentation is not live, but I do have some info on how to fetch information on external links in the meantime.
{% for link in custom.[category].att.external_links %}
{{ link.name }}
{{ link.url }}
{% endfor %}
You can also check for size: custom.[category].att.external_links.size,
For your use case I would use .size on the documents and the links.
custom.[category].att.documents.size+custom.[category].att.external_links.size > 0
KR
Romy