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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

VendorInvoiceLineEntity - update defaultdimension based on Project's defaultdimension

(1) ShareShare
ReportReport
Posted on by 134
I've extended the VendorInvoiceLineEntity to include VendInvoiceInfoLine_Project as an outer join and am successfully saving/updating records via OData both when I have a project and when I don't.
 
The last hurdle I'm facing is that when a project is included (VendInvoiceInfoLine_Project is populated), the field VendorInvoiceLineEntity.Dimension should be updated to the DefaultDimension from ProjTable for the ProjId in VendInvoiceInfoLine_Project.  In other words, if a Project is populated, the Project's default dimension should be used.  This is what happens when entering a Vendor Invoice through D365 manually.
 
However this field is Private in the Data Entity:

 
Is there any way for me to update this field based on the Project's DefaultDimension?  Note that these are usually Vendor Invoices without POs so we can't pull any data from the PO.
 
From my database (VendInvoiceInfoLine table), the record with DefaultDimension populated below was entered through the D365 application manually where project and project category were entered instead of an account string and the other three records were interfaced through the VendorInvoiceLineEntity with a Project and Project category populated in the message.
 
 
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    306,272 Super User 2026 Season 1 on at
    Moved the question from the Dynamics 365 General to the Dynamics 365 Finance & Project operations forum.
     
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    306,272 Super User 2026 Season 1 on at
    Hi Jackie,
     
    The reason that this field is Private, is because this is storing the reference record ID beloning to a dimension value set. It is not managing the dimensions as concatenated string. 
    In case you want to copy the dimensions from the project, you can use X++ coding to find the dimension and then default the dimension value from the project. You can e.g. use the method mapEntityToDataSource() for this purpose.
  • JackieMc Profile Picture
    134 on at
     Hi,
     
    I'm still getting this compile error when I put the logic in the mapEntityToDataSource() extension:
     
    Field 'this.Dimension' is private and can only be referenced from within the element in which it is declared.
     
    Here's my code in my extension - am I using the wrong syntax for this??:
     
    public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
    {
        switch (_dataSourceCtx.name())
        {
        case dataentitydatasourcestr(VendorInvoiceLineEntity, VendInvoiceInfoLine):
            VendInvoiceInfoLine vendInvoiceInfoLine = _dataSourceCtx.getBuffer();
            if (this.ProjId)
            {
                LedgerDimensionAccount projDefaultDimension = ProjTable::find(this.ProjId).DefaultDimension;
                this.Dimension = projDefaultDimension;
            }
        }
        
        next mapEntityToDataSource(_entityCtx,_dataSourceCtx);
    }
     
    (note I've tried having my case stmt reference VendInvoiceInfoLine and VendInvoiceInfoLine_Project but I get the same result)
  • Verified answer
    Shaluma Profile Picture
    369 on at
    Hi,

    Please try the below repharse code,

    this.Dimension
    → which hits the Private field directly on the entity please change your code instead of this to vendInvoiceInfoLine.DefaultDimension

     vendInvoiceInfoLine.DefaultDimension = projDefaultDimension;

    If the issue still persists after following them, please raise a query, and we will be happy to support you further.

    Thanks,
    If you found it helpful, please consider marking it as verified — it may be useful for others in the future!
  • Verified answer
    Martin Dráb Profile Picture
    240,008 Most Valuable Professional on at
    You can assign a value of VendInvoiceInfoLine.DefaultDimension field directly:
    public void mapEntityToDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx)
    {
        switch (_dataSourceCtx.name())
        {
            case dataEntityDataSourceStr(VendorInvoiceLineEntity, VendInvoiceInfoLine):
                VendInvoiceInfoLine vendInvoiceInfoLine = _dataSourceCtx.getBuffer();
                vendInvoiceInfoLine.DefaultDimension = ...;
                break;
        }
    
        next mapEntityToDataSource(_entityCtx, _dataSourceCtx);
    }
  • JackieMc Profile Picture
    134 on at
    Hi @Shaluma and @Martin Dráb - thank you so much!  It's working now as expected.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 433 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 382

#3
Martin Dráb Profile Picture

Martin Dráb 279 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans