Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Prevent copying objects by the user

Forum

Search UsersRules
Prevent copying objects by the user
#1
Just came
Points:: 0
Joined:: Jul 31, 2014

Hello,

what's the correct way to prevent copying objects by the user.

I am currently throwing an exception inside the OnCopy procedure of the
object module.

Thx for your help!

Profile
#2
Active user
Points:: 0
Joined:: Nov 3, 2011

Oliver,

the platform design implies that copying is just creating a new object (plus filling it with some data). Therefore, providing a special tool that prevents copying just does not seem right.

Throwing an exception inside the OnCopy procedure looks like the best solution to me.

Profile
#3
Active user
Points:: 0
Joined:: Apr 18, 2012

Hi, Oliver.

If you don't want to show message box with error there is another solution.
You can hide button "copy".
Open form in Designer, open form's properties, click "open" in the row "command set" and uncheck "Copy". You must do it for all forms.

Unfortunately, in the list form key F9 still works.
We can prevent it with this code.

Code
&AtClient
Procedure ListBeforeAddRow(Item, Cancel, Clone, Parent, Folder, Parameter)
   If Clone Then
      Cancel = True;
   EndIf;
EndProcedure


Or this version in the object form
Code
&AtServer
Procedure OnCreateAtServer(Cancel, StandardProcessing)
   If ValueIsFilled(Parameters.CopyingValue) Then
      Cancel = True;
      Return;
   EndIf;
EndProcedure

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.