Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > After ins ert return Catalog Code Field Val ue

Forum

Search UsersRules
After ins ert return Catalog Code Field Val ue
#1
Just came
Points:: 0
Joined:: Oct 9, 2018

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?

Profile
#2
Interested
Points:: 0
Joined:: Dec 4, 2017

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

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.