Cpy Document for Item

aliennavaliennav Member Posts: 449
I want to make a similar functionality as "Copy Document" for copying the items(With not copying the item No.).
How it can be achieved??

Comments

  • kinekine Member Posts: 12,562
    Something like:
      ItemNew := ItemOld;
      ItemNew.VALIDATE("No.",'');
      ItemNew.INSERT(True);
    

    But you need to check that all related things are created too, like default dimensions etc. This code is without warranty, just for illustration how to do it...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • aliennavaliennav Member Posts: 449
    Thanks.
    I'll try this.
    Also, the copy document functionality is a bit complicated which MS has provided.
  • aliennavaliennav Member Posts: 449
    kine wrote:
    Something like:
      ItemNew := ItemOld;
      ItemNew.VALIDATE("No.",'');
      ItemNew.INSERT(True);
    

    But you need to check that all related things are created too, like default dimensions etc. This code is without warranty, just for illustration how to do it...

    Hi Kine
    I think that the validate would'nt work as the No. is the primary field and it cannot be empty.
    Instead we should get the next no. in it.
    Am I right??
  • jannestigjannestig Member Posts: 1,000
    If you are doing this to create new items.

    Why not look at the apply template functionality on the item card. Item card > functions > Apply Template

    You can set up many templates with defined values in whatever fields you want.

    Look under administration to set these up. Administration > general > master templates
  • aliennavaliennav Member Posts: 449
    Thanks jannestig but in master template creation "Unit of measure, unit price " etc. are not allowed.
    The system is giving error.
    Is there any way out for these fields.

    My requirement is:Copy the fields of previous item no. except the fields "No.",Name of item will remain same, UOM will remain same.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    The code is straightforward as Kamil suggested - you just need to list all the tables required. I know at least three companies (including ourselves) that offer this as an add-on - we expanded this out to copy from different companies.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • jannestigjannestig Member Posts: 1,000
    Read up about how to use the templates if code is not your prefered method

    Its part of the rim toolkit , W1W1 Dynamics NAV RIM Users Guide 2.0.doc
Sign In or Register to comment.