Write a COC on entity method to not allow updates in certain scenarios

Hi all,

I am writing a COC on an entity and extending the insertEntityDataSource(DataEntityRuntimeContext _entityCtx, DataEntityDataSourceRuntimeContext _dataSourceCtx) method, in the standard for the entity when this method is called the data source fields are updated, however I have a requirement wherein I do not want the field values to get updated & have the original values to remain intact. Could anyone please help me how can I achieve this?

What about conditionally calling _dataSourceCtx.setDatabaseOperation(DataEntityDatabaseOperation::None)? Although I would do it earlier than in insertEntityDataSource(), if possible.

I see one problem here.You said that you have scenario where you don’t want fields to be updated.

Are those standard fields.If yes there must me reason for update.Would be good if you can provide entity name and fields you are trying not to get updated.To avoid data consistency issue.

This will also help us to provide where to use methods in Entity level or is it something you also want to implement in General CRUD operation.

This can give us direction if this to be done in table level itself then…

Thanks and have a nice Day!

Thanks for your reply, it was a date field I wanted to provide values based on certain conditions have resolved it now by using the suggestion which Martin has given. Thanks again Martin