Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Create Document and get UUID

Forum

Search UsersRules
Create Document and get UUID
#1
Active user
Points:: 0
Joined:: Feb 26, 2015

Hello there

I want to create documents with the code.
I have one document. Name the Test.
It contains 3 records.
I want to add another record. How do I do with this code?
I want to find the UUID of the created record.

Profile
#2
Just came
Points:: 0
Joined:: Aug 8, 2016

Hello Uguz!
It's very simple.

Code
DocTest = Documents.Test.CreateDocument();
DocTest.Write();
UUID = DocTest.Ref.UUID();

Profile
#3
Active user
Points:: 0
Joined:: Feb 26, 2015

hi

Code
Function TestEkleTestEkle(Request)
   Response = New HTTPServiceResponse(200);
    Result = "";
              
      
   nesne = Documents.Test.CreateDocument();

   nesne.Alan1="a";
   nesne.Alan2="b";
   nesne.Alan3="c";
   nesne.Write();
   
   Return Response;

EndFunction



Quote
{HTTPService.Test.Module(12)} : An error occurred in the process of content method call ( Write )

Profile
#4
Guest
Points::
Joined::

Hello, Erdogan!

Maybe you have some script in the object module of the Test document that prevents writing.

If this wouldn't help, please provide a sample configuration where I could reproduce the issue. You can attach it to the message or send to int@1c.com.

Profile
#5
Active user
Points:: 0
Joined:: Feb 26, 2015

Thank you (www.1tc.com.tr -> Stas)

Solution :

Code
Function TestEkleTestEkle(Request)
   Response = New HTTPServiceResponse(200);
    Result = "";
                    
   nesne = Documents.Test.CreateDocument();
   nesne.date= CurrentDate(); // The date should be not empty.
   nesne.Alan1= "a";
   nesne.Alan2="b";
   nesne.Alan3="c";
   nesne.Write(DocumentWriteMode.Posting);

   
   Return Response;

EndFunction

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.