Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

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

(1) ShareShare
ReportReport
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,587 Super User 2024 Season 1 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 11,955 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

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,904 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans