Skip to main content
Solved

How to Disable Duplication in Configuration

  • 26 July 2024
  • 5 replies
  • 74 views

Any idea how to disable it at the configuration level without development? I have created a custom entity and want to block duplication while still allowing the insertion of new records.

24r1

 

 

5 replies

Userlevel 4
Badge +9

What do you mean by duplication ?

 

If you mean SPECIFICALLY the duplication button, i.e. The Client level button, I don’t think that’s possible as that’s likely coded at framework level and available to any user that has Write access to that entity (just like the “+” button for insert), but all the duplication button does is replicate all field values, it doesn’t SAVE.

 

If you want, you can simply prevent the saving by defining fields that shouldn’t be duplicated as alternate keys in the custom Entity definition, as long as they’re persistent fields.

 

For example:

 

 

This effectively makes your persistent fields part of a unique combination key, which the custom entity will only allow 1 unique combination being inserted.

 

It doesn’t have to be ALL fields being Alternate Keys, just at least two (and up to all of them).

 

So determine which combination is allowed or not and make the relevant keys alternate to block duplication of values which you don’t want to see multiple times.

 

As long as two keys or more are set to alternate, clicking duplicate would duplicate all keys (and therefore including the alternate keys) and the user would then no longer be able to save.

 

When inserting new records, they still wouldn’t be able to “MANUALLY” duplicate any entries either, whether they clicked the duplicate button or the + button, either way they would get blocked when trying to save.

Userlevel 1
Badge +3

@SimonTestard,
Thank you for the interesting idea.
I meant the duplication button, but your solution is worth considering.

Userlevel 4
Badge +9

@SimonTestard,
Thank you for the interesting idea.
I meant the duplication button, but your solution is worth considering.

 

@Tomasz Grzebula , Coming back to you on this, I figured out a way to do it, but it requires Page Designer context configuration, if you’re okay with doing that (so it’ll be context dependent).

 

On your custom page, you should have configured your page to be linked to your custom entity, and created a list that reads from that entityset.

 

On the list definition, you can actually create CRUD Action Overrides and force a button to be disabled, this way:

 

 

 

This is a bit “tricky” to find out, because when you create the CRUD action, you’ll need to click + for the “Duplicate” Crudaction, and first tick the box, otherwise it won’t let you create the overide:

 

 

 

Tick Enabled even if you actually want to disable it, otherwise you can’t Confirm

 

Once Confirmed, it looks like this:

 

 

 

 

You can now force untick the “Enabled” tickbox to disable Duplication.

 

Outcome when you do :

 

Duplication Client Button now disabled on that list

 

 

You can do similar things if you want to disable New/Edit/Delete, or if you want to alter the savemode :)

 

Hope that helps !

Userlevel 1
Badge +3

It works!

 


I need to block duplicate comments in general, regardless of context. Therefore, I believe in my case it doesn’t require Page Designer context configuration, does it?


 @SimonTestard thank you!

Userlevel 4
Badge +9

 I believe in my case it doesn’t require Page Designer context configuration, does it?


 @SimonTestard thank you!

 

No worries.

 

Technically what you’ve just done in your Page designer is applied to the context you had selected in the Page Designer. By default that context is “global”.

 

Do you have any other contexts with Context Configuration Mappings ?

If you do not, then yeah it’ll block it regardless, but IF you DO have multiple contexts, you should apply probably apply that same designer configuration on all contexts :)

Reply