After ins ert return Catalog Code Field Val ue

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Just came
Rating: 1
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
Interested
Rating: 16
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
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.