web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Document attachment entities cross company

(1) ShareShare
ReportReport
Posted on by 148
Hi!
 
In Finance and Operations there are some default out-of-the-box document attachment entities, for example for Customer (CustomerAttachmentsV2Entity). However, they are not programmed to support cross company attachments. Is there anyone who could think of why this functionality is not included? Is there a risk or problem by doing that?
 
Thanks and regards!
Categories:
I have the same question (0)
  • hca Profile Picture
    148 on at
    Document attachment entities cross company
    Thank you Sohaib, yes it is out of the box and it does not support cross company. I'm wondering why they may have done this. Was it not considered, or is there some drawback to allow cross company in a custom attachment entity?
  • Sohaib Cheema Profile Picture
    48,616 User Group Leader on at
    Document attachment entities cross company
    Hi,
     
    I have checked it.
     
    This data entity has a value for property named PrimaryCompanyContext because of which it cannot operate cross-company
     
     
    it is an out of the box entity
  • hca Profile Picture
    148 on at
    Document attachment entities cross company
    To be more specific, the OData request for the document returns a result, but the content of the file is empty because the file content is in another company.
     
    Here is a typical attachment entity logic that fetch the file. The select statement needs to go cross company to return results from other companies.
    /// <summary>
    /// Entity used to Dual-Write document attachments for the <c>CustomerAttachmentsV2Entity</c> table.
    /// </summary>
    public class CustomerAttachmentsV2Entity extends common
    {
        /// <summary>
        /// Populates virtual fields.
        /// </summary>
        public void postLoad()
        {
            super();
            // Virtual fields are not auto-populated from the base entity, so an extra select is necessary.
            if (this.RecId && this.DocumentId != emptyGuid())
            {
                DocuRefEntity baseEntity;
                select firstonly baseEntity where baseEntity.DocumentId == this.DocumentId;
                this.FileContents = baseEntity.FileContents;
                this.fieldExternallySet(fieldNum(CustomerAttachmentsV2Entity, FileContents), false);
            }
        }
    }
  • Sohaib Cheema Profile Picture
    48,616 User Group Leader on at
    Document attachment entities cross company
    Hi
     
    There is a field named LegalEntityId in this entity. Could you check it out of that works for you? As for the primary key is based on Document ID.
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,257

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 913 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 611 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans