Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

View Attachement from Dataverse in Form / Page

(0) ShareShare
ReportReport
Posted on by 22

Hello everyone,

 

I have a Power Page with a Form which is built on a Dataverse table. This Form allows the User to upload attachements

and after a lot of research, I learned, that the Attachement isn't saved directly in the underlying table but instead in another System table named 'annotations' (or notes, according to the original article I had read?).

 

Now I want to have another Form which will allow a different set of Users to view and edit entries in my original Dataverse table (the one with the Form) - not a big Problem, except for the attachements. 

I can't figure out how to add the attachements to a form or page in order to allow my Users to view/download the attachements.

 

Any advice is appreciated! ❤️

 

Regards,

MiniDev

Categories:
  • MiniDev Profile Picture
    22 on at
    Re: View Attachement from Dataverse in Form / Page

    I can't seem to find a column named regardingobjectid...
    And the objectid field is empty. 

  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at
    Re: View Attachement from Dataverse in Form / Page

    Hi @MiniDev ,

     

    For the reference to the table, there is a column regardingobjectid column available that contains reference.

     

    Thanks,

    Saud

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • MiniDev Profile Picture
    22 on at
    Re: View Attachement from Dataverse in Form / Page

    Hey, this is an interesting solution which will help me in another project. However for my current problem this is not applicable.

    I did make some progress in my search for a solution though. I found, that the ObjectId field of the annotations Table is empty for all entries generated by the form. I assumed, that there would be a reference to the table which the form is based on... Am I missing an option somewhere?

  • Saud Ali Profile Picture
    812 Super User 2024 Season 1 on at
    Re: View Attachement from Dataverse in Form / Page

    Hi @MiniDev ,

     

    I think I got your point what you're looking for, I would recommend you add a Timeline control on your Portal form, and it will automatically show all the attachments being uploaded from the Portal. I was having the same requirements for one my clients in the past and I did it using Timeline control filtered to show Portal Comments. By enabling timeline control user can see their attachments/notes and can download as well without any extra code.

     

    Here is the view how it was looking at the end for my client. Do let me know if it will work for your or you need any assistance.

    saudali_25_0-1687426288514.png

    Thanks,

    Saud

     

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • MiniDev Profile Picture
    22 on at
    Re: View Attachement from Dataverse in Form / Page

    I'm afraid my problem still remains. 
    I will try to rephrase my problem: I have a Table A which is filled with information when a user submits a form and the attachements of that form go into the Annotations Table. So each Entry in Table A is associated with at least one Entry in the Annotations Table. But I can't seem to find a reference, a GUID or anything which allows me to identify which Entry belongs to which between those two tables. 

    I hope the problem is a bit more clear now and thanks for the efforts so far 🙂 

  • Squire4Hire Profile Picture
    125 on at
    Re: View Attachement from Dataverse in Form / Page

    @MiniDev- This is how I was finally able to do it...

    You're correct that files are uploaded/stored in the Note (annotations) table when you use the File Attachments control on a form. Using FetchXml, you can link to the annotations table in order to get/show the required fields necessary. You're going to need the related mimetype and documentbody fields at a minimum, and will likely need the filename field too. It would look something like this:

    {% fetchxml files %}
     <fetch mapping='logical'>
     <entity name="your_tables_logical_name">
     <attribute name="a_column_from_the_parent_table" />
     <attribute name="another_column_from_the_parent_table" />
     <link-entity name="annotation" from="objectid" to="your_tables_logical_nameid" link-type="outer" alias="your_alias">
     <attribute name="filename" />
     <attribute name="mimetype" />
     <attribute name="documentbody" />
     </link-entity>
     </entity>
     </fetch>
    {% endfetchxml %}

     

    I assume you know where to get the logical names for the table and columns If not, you can go to Data in the Design Studio and look at the associate Table Properties and Column Properties.

     

    Once you've fetched the data with the linked notes items, you can iterate through them and use the Base64 encoding of the documentbody with the mimetype to either display the image or download the document. It would look something like this:

     

    <div class="row">
     {% if files.results.entities.size > 0 %}
     {% for file in files.results.entities %}
     <div class="col-lg-6">
     <p>{{ file.a_column_name_from_the_parent }}</p>
     <img src="data:{{ file['your_alias.mimetype'] }};base64,{{ bio['your_alias.documentbody'] }}" />
     <a href="data:{{ file['your_alias.mimetype'] }};base64,{{ bio['your_alias.documentbody'] }}" download={{ file['your_alias.filename'] }}> Download Link </a>
     </div>
     {% endfor %}
     {% endif %}
    </div>

     

    Notes:

    - The <img> tag will display the image on screen

    - The <a> tag with the 'download' attribute will allow the user to download the file by clicking on the link and will assign the stored document filename as the default filename.

    - your_alias can be anything you want, but it is required for the linked entities to function properly.

    - This should work for any images and document types, but you may need to adjust it accordingly for any other file types.

     

     

  • Squire4Hire Profile Picture
    125 on at
    Re: View Attachement from Dataverse in Form / Page

    @FubarI'm not calling anyone out. I'm pointing out that a response without quality is not a response at all.

     

    While you may feel that the time and effort to post a link to a page that does not actually address a question is not being appreciated, I feel as though it's a huge disservice to the entire community and a waste of everyone's time in trying to find answers to questions that are being asked. It comes from a place of frustration and is not a personal attack.

     

    Sure, it may be up to OP to determine if the answer is sufficient for them, but I don't think there's anything wrong with pointing out how an answer lacks substance or misdirects anyone else looking to solve the same problem(s).

     

    I appreciate the fact that you took a bit more time to outline the potential possibility that a file can somehow be retrieved from the Note table. At least it's a place to start.

  • Fubar Profile Picture
    7,960 Super User 2025 Season 1 on at
    Re: View Attachement from Dataverse in Form / Page

    @MiniDev one thing I hadn't realized is that the metadata Edit will only work for the Portal User that uploaded the attachment, download and create is still available to anyone with Table Permissions to read/create it.

     

    Also if you have a Notes attachment created from Dataverse e.g. Model Driven App, if you want it to be displayed on the timeline on the portal you need to prefix the note Description with *Web*

  • Fubar Profile Picture
    7,960 Super User 2025 Season 1 on at
    Re: View Attachement from Dataverse in Form / Page

    @Squire4Hire wrote:

    The same question is asked here and remains unanswered.


    It is not actually the same question.  The question being asked on the other post is how to render an image that is stored in a notes attachment on the page.

     

    In most cases Notes attachments are not images (but they can be).  Having a timeline control and the metadata will provide a clickable link that will allow the browser to download the attachment or if the Browser has appropriate add-ins (browser add-ins nothing to do with the Portal) open in a browser tab.

     

    To render an image, you would need to customize things and use Liquid and fetchXML, or the Portals Web API to extract the body and then put it as an img tags source (can't remember for img src but you may also have to  base64 decode it also)

  • Fubar Profile Picture
    7,960 Super User 2025 Season 1 on at
    Re: View Attachement from Dataverse in Form / Page

    @Squire4Hire wrote:

    @Fubar, neither you or @OliverRodrigues address OP's question (and as far as I can tell, it's not addressed on the documentation you linked) -- "I can't figure out how to add the attachements to a form or page in order to allow my Users to view/download the attachements."


    How about you let the OP decide if what has been provided answers their question or not - and if not answered clarify what they are after. Be aware this is community support the time that people like Oliver, myself and others spend here is not paid for by anyone - 'calling people out' is not appreciated.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >