Copy existing Item from Card to new Item Card

tompynationtompynation Member Posts: 398
Hi,

would this be possible?

Suppose you are in the item card watching to Item No. 1,

You press a copy button which should automatically open a new Item Card
containing the Data of Item No. 1 but it should not contain the Item No.

Cause the Copy will be used to add new Items in a verry fast way, so you should just enter a new item No.

lv_Item.Category := rec.Cat;
I tried with form.Run("Item Card",lv_Item)

But the Form that opens does not contain the category, but it copied the Item No. ?

Comments

  • DenSterDenSter Member Posts: 8,305
    Open the Item List form from the Item Card, highlight the Item that you want to copy, hit Ctrl+C. Close the Item List, which brings back the Item Card. Hit F3 to create a new empty record, hit Ctrl+V to paste the Item in. You'll get an error message saying "Item already exists" but the Item is pasted into the form. Change the Item number and voila, you have an exact copy of the Item.

    All you need to do is take care of subsidiary records, such as Item Units of Measure. Your new Item will have the same units, but you will have to create the "Item Unit of Measure" records that belong there.
  • Sandeep_PrajapatiSandeep_Prajapati Member Posts: 151
    The following code might help you. For the COPY function you want
    Name	DataType	Subtype	 
    it	Record	Item	
    
    
      it.INIT;
      it.RESET;
      it.COPY(Rec);
      it."No." := 'Test';
      it.INSERT(TRUE);
      FORM.RUN(30,it);
    
    


    but there r lot of validations you have to take care of. Possible care would be...
    1) validating all fields before inserting.
    2) special attention to Lookup fields for whether the master value exists or not in the corresponding master table. [ Base Unit Of Measure has a intermediate table -- "Item Unit of Measure" and lookup master table - "Unit of Measure". Values in the "Item Unit of Measure" must be inserted before inserting into Item table,... this should be handled in the code while copying.]

    More Inputs are welcome from the Experts. O:)
    Sandeep Prajapati
    Technical Consultant, MS Dynamics NAV
  • McClaneMcClane Member Posts: 40
    if you asked for the new Item No. at first and do the insert&TransferFields after that, it would be a lot easier :wink:
  • SavatageSavatage Member Posts: 7,142
    Daniels way is the method I've always used.

    Go to item card. Edit->Select->Copy->F3->Paste->"Ignore Message"->Change the item number to something new.
  • DenSterDenSter Member Posts: 8,305
    I had forgotten the 'edit-select' part from the Item Card, thanks Harry =D>
  • mart1n0mart1n0 Member Posts: 123
    The German localization has a feature to copy items. Might be interesting to have a look at the code of it.

    Item Copy
    Companies often maintain groups of similar items in an item catalog, and many settings are typically the same. When you add a new
    item, you can use Item Copy by copying information from an existing item into a new one.
    To copy an item, click Item Copy from the Functions button of that item card. Item Copy is also available in the item list. Choose
    which data to copy in the request form:
    Base data
    Item comments
    Picture
    UOMs
    Variants
    Dimensions
    Extended texts
    Translations
    BOM components
    Prices
    Service -related information
    Item Copy supports number series and manual numbers for the new item number.
  • SavatageSavatage Member Posts: 7,142
    Too Bad - I Just don't have a German Version Laying around :lol:
  • garakgarak Member Posts: 3,263
    if you need it, i will post it here.
    Do you make it right, it works too!
  • AdamRoueAdamRoue Member Posts: 1,283
    What about the standard templates? Depends upon the version, I presume from the Functions button on the item card you do not have "Apply template"? In this method you would create a new record, then copy everything else in, which is slightly different to your original request, but gets you your end result!
    The art of teaching is clarity and the art of learning is to listen
Sign In or Register to comment.