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 :
Dynamics 365 Community / Forums / Finance forum / How to skip validation...
Finance forum

How to skip validation in data entity

(0) ShareShare
ReportReport
Posted on by 2,120

Hi Techies,

I have created a new data entity. While importing a data, in staging table it throws below validation error -

Results. insert not allowed for field 'Transaction ID(TransId)'
Results. Validations failed

Datasource - ProjOnAccTrans.

I tried writing below code to skip this validation in multiple methods, but it won't work until I skip this validation from 'Modify target mapping' form.

 this.skipDataSourceValidateField(fieldNum(ProjOnAccTransEntity, TransId), true);


 Is there any other feasible way to do this via code?

Any response is appreciated.

Thanks,

Sangram

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    306,294 Super User 2026 Season 1 on at

    Hi Sangram,

    Initially, it looks like the field has been set to not allow edit. What is the property value on the datasource field? If it is set to No or Auto, try the option Yes.

    Did you also perform a metadata search to see where Microsoft did use this command in their own application?

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    This used to work:

    public void persistEntity(DataEntityRuntimeContext _entityCtx)
    {
        this.skipDataSourceValidateField(fieldNum(ProjOnAccTransEntity, TransId), true);
    
        super(_entityCtx);
    }


    Try!

  • Sangram Shinde Profile Picture
    2,120 on at

    Yes i tried in persistEntity method as well Ievgen, but the error is occurring before hitting this method itself.

    Thanks,

    Sangram

  • Sangram Shinde Profile Picture
    2,120 on at

    Hi Andre,

    I will check this and update.

    Thanks,

    Sangram

  • Mea_ Profile Picture
    60,286 on at

    Where exactly are you getting this error?

  • Sangram Shinde Profile Picture
    2,120 on at

    Hi Andre,

    AllowEdit and AllowEditOnCreate are set to 'No' at table properties(ProjOnAccTrans) as you said. But this is a standard table, what is possible way to change this property.

    Thanks,

    Sangram

  • Mea_ Profile Picture
    60,286 on at

    You don't need to change them, all you need is to skip validation, that's exactly why skipDataSourceValidateField method is available.  And you did not tell us where this error is coming from, did you try to debug and investigate?

  • André Arnaud de Calavon Profile Picture
    306,294 Super User 2026 Season 1 on at

    Hi Sangram,

    You can check these properties on the fields of the data entity. Don't change this property on the original (target) table.

  • Sangram Shinde Profile Picture
    2,120 on at

    Hi Andre, I changed the property from Auto to Yes from entity level and tested, but it didn't work, then I switched to debug the code again to trace the exact code to share with Ievgen for solution, and in this run - the execution ran from DMFEntityBase ->_target.insert() method(Line 2312) to persistEntity() method (Which I was waiting for) that I have written in data entity to skip this validation and it works!

    I am not sure why it wasn't working initially, I have cleaned everything and kept only persistEntity() method, this might have worked.

    Thanks Andre and Ievgen for the solutions and the time, your answers are always helpful.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans