Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Expense journal line e...
Finance forum
Suggested answer

Expense journal line entity customization for financial tags with read-only data source

Posted on by 121
Dear Expert,
 
I had one requirement to add financial tags to ExpenseJournaLineEntity for excel add-ins. So I created extension for the entity and added FinTag table as read-only data source to the entity. Also added DisplayValue field to the field list. and wrote resolveFinTag method same as LedgerJournalLineEntity and called it from insertEntityDataSource and updateEntityDataSource. 
 
 private void resolveFinTags(LedgerJournalLineEntity _entity, LedgerJournalTrans _ledgerJournalTrans)    {        if (FinTagFeature::isEnabled())        {            _ledgerJournalTrans.FinTag = FinTagResolver::resolve(_entity.FinTagDisplayValue, _ledgerJournalTrans.Company);            _ledgerJournalTrans.OffsetFinTag = FinTagResolver::resolve(_entity.OffsetFinTagDisplayValue, _ledgerJournalTrans.Company);        }    }
 
 
When I am trying to import data from excel add in, I am getting error for insert and update that /Matching record for read only data source 'FinTag' does not exists/. I tried everything including skipping validations on data entity, still it did not work.
 
However I observe one weird behaviour, If I change newly added data source read-only property to 'NO' and build the project and again change it back to Read-Only 'YES' and build project again then I do not get the error and data is inserted / Updated. I tried this with multiple development environment and its working. But I can not do it on sandbox or Production. Any Idea how to resolve it or any method where I can wrote some logic. Thanks!
  • Sumit Bhagat Profile Picture
    Sumit Bhagat 121 on at
    Expense journal line entity customization for financial tags with read-only data source
    Hi Bharani & Mohamed,
     
    I do not have this fields in staging tables. I just want to update this financial tags through excel add-ins (Odata) so I added them to the data entity and it is working fine, if I do above mentioned workaround with changing property of data source and build. 

    Also, The data source itself is read-only still Do I have to make its allowedit property to NO ? 
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,532 Moderator on at
    Expense journal line entity customization for financial tags with read-only data source
    Make allowedit and allow edit on create property both on entity and staging fields for the new table as no.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 8,899 Super User 2024 Season 2 on at
    Expense journal line entity customization for financial tags with read-only data source
    Hi @Sumit,
     
    I suggest to use postTargetProcess method to apply your business logic.
     
    e.g.
        public static void postTargetProcess(DMFDefinitionGroupExecution _dmfDefinitionGroupExecution)
        {
            CustTable               custTable;
            CustCustomerV3Staging   staging;
    
            if(_dmfDefinitionGroupExecution.StagingStatus == DMFBatchJobStatus::Finished)
            {
                while select custTable 
                    join staging
                    where staging.ExecutionId == _dmfDefinitionGroupExecution.ExecutionId
                    && staging.DefinitionGroup == _dmfDefinitionGroupExecution.DefinitionGroup
                    && staging.TransferStatus == DMFTransferStatus::Completed
                    && staging.CustomerAccount == custTable.AccountNum
                    {
                        //your business logic here
                    }
            }
        }
     
    Best regards,
    Mohamed Amine MAHMOUDI

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Mohana Yadav!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,115 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,971 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans