Unable to update current datetime

anilkumaranilkumar Member Posts: 136
Hello Nav Experts!

I am unable to update current datetime in a filed in Item table.

I have created new field "Last modifed date time" in Item Table. If any changes or created any record in sales price table the new field should update current date time.

Manually In Retail Item card if I changed sales price related filed it is updating the current date time, but while import data through Mapping (Form 8601 standard) it is not updating the current datetime.

My code as follows:

Item.GET("Item No.");
Item."Last DateTime Modified" := CURRENTDATETIME;
Item.MODIFY;

Can any Expert suggest how to solve this problem ??
Anil Kumar Korada
Technical Consultant

Comments

  • kinekine Member Posts: 12,562
    And the code is placed where?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • anilkumaranilkumar Member Posts: 136
    Hi Kine,

    Thanks for quick response!

    Code is place in on Modify of Sales Price table.
    Anil Kumar Korada
    Technical Consultant
  • kinekine Member Posts: 12,562
    Imports through the Mapping form is not calling the OnModify trigger when modifying the record. It is why it is not working... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • anilkumaranilkumar Member Posts: 136
    Hi Kamil,

    Thanks a lot!

    If I want to validate in Sales Price table or Item table then where I should write code??

    If that field totally blank then I can able to update the field with current datetime through Mapping form.
    But I am unable to blank that field, If any value is existing, I hv already tried with 0DT, but not working??
    Anil Kumar Korada
    Technical Consultant
  • kinekine Member Posts: 12,562
    Add some new option into the header of the mapping, find the code, where the records are inserted and add condition, that if the new field in header is set, than modify/insert the records with calling the triggers... ;-)

    Take it as small exercise... it is not hard... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • anilkumaranilkumar Member Posts: 136
    Thanks for Quick Response!

    But existing Mapping functiionlaity should not be distrib for this customization, Have to do what ever customization in Item or Sales Price table. Can you plese help me where to write the code??
    Anil Kumar Korada
    Technical Consultant
  • kinekine Member Posts: 12,562
    You cannot "solve" this through modification of those tables (or if yes, than in complicated way). Modification of the Mapping functionality when done correctly is only question of one new field and one or two lines in the standard code. But it is on you. If you need another way, it is your choice... :wink:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • anilkumaranilkumar Member Posts: 136
    Hi Kamil,

    Thanks for excellect support!

    I will try for complicated way. Thanks for made the problem more clear.
    Anil Kumar Korada
    Technical Consultant
Sign In or Register to comment.