Modify an item using Item Template

patelashlesh83patelashlesh83 Member Posts: 54
edited 2011-08-06 in Dynamics AX
Hi,

I can create a new item using Item Template. My question is can i modify an item using Item Template?

I didnt find any option available on Item Details form. Is it possible using X++ (coding)?

Thanks in advance.

Regards,
/Ashlesh

Comments

  • Faithie_RobertsonFaithie_Robertson Member Posts: 24
    Yes, it's possible with coding (everything is possible with coding :P ):

    // APPLY TEMPLATE
    RecRef.GETTABLE(Item);
    TemplateMgt.UpdateRecord(DataTemplateHdr,RecRef);


    Item = Record datatype, filtered to your record
    TemplateMgt = Codeunit Template Management
    RecRef = RecordRef datatype

    Be sure you retrieve your record again after this so your ITEM record has the changes. Otherwise, any other mods that follow could wipe out what you did with your template update as your version of the ITEM record will overwrite the one modified through the codeunit.
    So You Want to be NAV Developer?
    http://www.archerpoint.com/blog/faithie-robertson
    A blog by Faithie Robertson
  • patelashlesh83patelashlesh83 Member Posts: 54
    Hi Faithie Robertson,

    Your solution is for AX 2009 ?

    Regards,
    /Ashlesh
  • kranthikranthi Member Posts: 72
    Template to modify may not available as it need to perform several validations.
    I believe, it is not really a good to have a template for modification.
    Creation happens once for a record - modification can happen number of times - when to trigger the template and every time checking the validations may not appropriate...
    Kranthi
Sign In or Register to comment.