Question

Restrict addition of more than 1 record per month in a detail

Dear team,

We are working on a detail where the user must add only one record per month. Could you please share the code/ or documentation link to work this out?

Thanks

Like 0

Like

5 comments

Maybe it is better if system creates one record for every user per month?

Hi Vladamir,

The following is our use case:

A sales user has to enter target revenue data for 8 product subcategories every month. We want to make sure that there is only one target data for each sub category. so each user will enter 8 rows of data every month. No more , no less. Is there a way we can achieve this?

This is very similar to the assignment for the dev certification where you can only have a certain number of daily periodicals. You can see an example for that in this post, see response from Anastasia https://community.creatio.com/questions/cant-return-validation-message

The basic concept is that you'll override the save method and perform an ESQ to determine the number of records already added for the month and then either allow the save, or prevent saving. 

Ryan

> implement Async validate

> create method to check data in detail based on the user / parent section. The logic is check count of current month, if current month is empty / 0, the user can add, else denied it

Hi Shivani,



You can also implement server side validation with Entity event layer. In OnSaving method you can check number of records and throw an exception if you have more than one.  



Regards,

Dmytro

Show all comments