After ins ert return Catalog Code Field Val ue


If you wish to leave comments or ask questions, please log on or sign up.

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Oct 9, 2018
Company: Ötüken Teknoloji Araştırma Geliştirme Eğitim Hizmetleri Ticaret Limited Şirketi

Hi.
I have got a catalog table.

-Code
-Description


I can ins ert record with code.

newrow = Catalogs.MyCatalog.CreateItem();
newrow.Description = "New Val ue";
newrow.Write();

I want to know the added number after adding the record.
What should I do for this?

Sample

insertedcode = newrof.Code ????
or ?
What should I do?

 
#2
People who like this:0Yes/0No
Administrator
Rating: 19
Joined: Dec 4, 2017
Company:

Dear Erdoğan Uğuz,

Here is the piece of code that solves the task you mentioned:

Code
&AtServerNoContext
Procedure AddNewItemAtServer()
                
                MyNewItem = Catalogs.MyCatalog.CreateItem();
                MyNewItem.Description = NStr("en = 'This is my new item'");
                MyNewItem.Write();
                
                ItemCode = MyNewItem.Code;
                
EndProcedure



Best regards,
Vladimir Gurov

1C Company support team
 
Subscribe