web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

a validation on item gtin code but facing issue as method is set as wrappable and hookable false.

(0) ShareShare
ReportReport
Posted on by

Could you please guide me with one scenario…
I need to add a validation on item gtin code. By default standard has set it to 14 digit and if user enter any digit lesser than 14 then it adds 0 to make it 14.
For example if we enter 222 then standard will change it to 00000000000222.
The changes I have to make is based on enum value the size should be like if enum US09 is selected and if user enters 787 then it should be changed to 000000787. That means based on enum only 0 will be added and size should not exceed the size written on condition.
My problem is that standard has used a method called formatgtin() in the table inventitemgtin but this method is wrappable(false) and hookable(false).
Also this is being called in standard in update , insert and validatewrite method. How I can add this validation or is there a way to stop formatgtin method from calling and i could call my custom method instead.
 

Please help.
I have the same question (0)
  • GirishS Profile Picture
    27,833 Moderator on at
    Hi Karuna,
     
    Forgot about the standard method.
    Add your whole logic on the OnInsertingEventHandler.
    This method will be called while inserting record in table and it will format gtin number as you coded.
     
    Thanks,
    Girish S.
  • Mohit Rampal Profile Picture
    12,565 Moderator on at
    Hi Karuna, You have to add your logic based on enum value in couple of methods like insert, update, findGTINNumeric, modifiedField etc of InventItemGTIN table, let standard code run and change the value after standard code execution like CoC on modifiedField will work, try OnInsertingEventHandler as Girish mentioned and let us know where you face issues.
  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at
    If the same standard format code is mentioned in insert method of table, then you can go for OnInserted event handler which will override the standard code again with your format.
     
    Thanks,
    Girish S.
  • Suggested answer
    vishalsahijwani Profile Picture
    213 on at
    Hi Karuna , 
     
    Since the hookable and wrappable property is already set to False. Its always better to find the place wherever its called - update() , insert() and validateWrite() and just call your custom method. Your custom method should update the value coming into this field. This will help you to lock this value as a final value.
     
    OnIsert Post or pre event handlers will not help as every time these event handlers will be called the standard method will override them eventually.
     
    Try this approach and let me know if this helps. 
     
    Also if this approach helps please mark this answer as a suggested answer. 
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 545 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 408

#3
Adis Profile Picture

Adis 267 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans