Hi All,
I am trying to skip validate write method of one of data source of my data entity. I have written code on saveEntityDataSource method as per below link.
" o skip validateWrite for all back-end tables for a data entity, a consumer can call DataEntity.skipDataSourceValidateWrite(Boolean _skip). This method turns validateWrite on or off for all data sources. By using the following API, you can skip validation for a particular data source, regardless of the consumer."
can anyone suggest why its not working in my case. please find attached image for reference.
I don’t see the reason for this error. Can you provide your code as text, so we can try to compile it by ourselves?
By the way, you have a bug at line 204. Assigning the value of skipValidateWrite() as the return value of saveEntityDataSource() makes no sense. Fortunately it doesn’t have any effect, because the value is immediately overwritten (at line 207).
Thanks for your input martin.
please find code as below.
public boolean saveEntityDataSource(DataEntityRuntimeContext entityCtx,
DataEntityDataSourceRuntimeContext dataSourceCtx)
{
boolean ret;
if(((entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Insert) ||
(entityCtx.getDatabaseOperation() == DataEntityDatabaseOperation::Update))
&& dataSourceCtx.name() == tableStr(PurchPool))
{
dataSourceCtx.skipValidateWrite(true);
}
ret = super(entityCtx, dataSourceCtx);
return ret;
}
This seems to be a bug in the documentation. The parent doesn’t have any method called saveEntityDataSource(), therefore referring to it by super() is wrong.
Thanks a lot martin to clarify my doubt.
Just wanted to check is there any way to bypass validateWrite method of specific datasource of data entity.
Regards,
Vinod
Yes, of course, that’s what skipValidateWrite()
method is for. You just need to call it from a valid method, such as insertEntityDataSource()
or initializeEntityDataSource()
.
Note that you can easily use references to find out where this method is used in standard entities.