Announcements
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
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.
Hi Sangram,
You can check these properties on the fields of the data entity. Don't change this property on the original (target) table.
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?
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
Where exactly are you getting this error?
Hi Andre,
I will check this and update.
Thanks,
Sangram
Yes i tried in persistEntity method as well Ievgen, but the error is occurring before hitting this method itself.
Thanks,
Sangram
This used to work:
public void persistEntity(DataEntityRuntimeContext _entityCtx) { this.skipDataSourceValidateField(fieldNum(ProjOnAccTransEntity, TransId), true); super(_entityCtx); }
Try!
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?
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156