DataHistory

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

Hello everyone!
I need to create log of data history (changes of any objects of type Documents.Order). For example I need to know who and when changed something (what attribute and how was changed) in these documents.
I am trying to use DataHistory functionality.
For example in "OnWrite" procedure of Document.Order object module I have written something like this:

Code
Data = ThisObject.Ref.GetObject();
CreationDate = CurrentDate();
User         = Catalogs.Users.FindByCode("Administrator");  
DataHistory.WriteVersion(
    Data,
    CreationDate,
        User.UUID(),
        User.Code,
        User.Description,
    DataChangeType.Update,
    "test");


but while I write object it gives me an error: "Metadata was not found: DocumentOrder".
I can see that line "User.UUID()" makes the error.
"User.Code" and "User.Description" are ok.
User "Administrator" exists for sure.
What am I doing wrong?
Thank you in advance for your answer.
Kris

 
#2
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

Ok, solved. I haven't used "DataHistoryUse" in Metadata for Order document. After using it - just works  :)

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.