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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

OnModifiedFieldValue() Event Handler Not Getting Triggered, Am I Doing It Right?

(1) ShareShare
ReportReport
Posted on by 1,044
Hi awesome community!
 
I'm trying to write a code that should run once a status field value has changed.
 
The table that has the status field is in Model1, and I want to write my code in a different model Model2.
 
And what I want to accomplish is when the status field will change to a different value for a record in a table in Model1, I want my code in Model2 to run.
 
I tried using /Events/ available in the table and copied the event handler and pasted it in a class in Model2.
 
The events I tried:
- OnModifiedField
- OnModifiedFieldValue
Screenshot for events in table:
 
But both of these events did not trigger when I changed the value in the Table in model1.
 
Note*: The status field value is changing through a workflow. So once I click on the workflow Approve button on the form for the workflow, the status field value will change once workflow is complete.
 
Why the events are not triggering? is it because I'm modifying the field through workflow?
 
How to achieve once the status field changed in the table in model1, the code in model2 should run?
 
Any advice is appreciated !
 
Thanks in advance!
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,190 Super User 2026 Season 1 on at
    Hi,
     
    You should create an extension of the workflow class methods like (completed) method and add your code there.
    Note in case you are working on custom workflow then you can add your code to workflow complete method directly.

    [ExtensionOf(classStr(YourWorkflowTypeEventHandler))]
    final class YourWorkflowTypeEventHandler_Extension
    {
        public void completed(WorkflowEventArgs _workflowEventArgs)
        {
             //Add your logic to update status
            // Call the standard method
            next completed(_workflowEventArgs);
    
            }
        }
    }


     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
     
     
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    The events will trigger if the method is triggered. The methods like modified or validateField will only trigger if you are calling them explicitly if you want them from code. When you change any value in a form then these will trigger from standard. So when you are changing this value you just need to write code like below.
     
    tableName.modifiedField(fieldNum(TableName, FieldName));
  • Suggested answer
    Komi Siabi Profile Picture
    13,233 Most Valuable Professional on at
    Like Waed said, the best place to put your logic is in the complete method in the workflow TypeEventHandler class.
  • Waed Ayyad Profile Picture
    9,190 Super User 2026 Season 1 on at
    Hi,

    Is your issue resolved? If yes, mark the answers that helped you as verified.


    Thanks
    Waed Ayyad
  • Momochi Profile Picture
    1,044 on at
     
    It's really strange that when I try to do a CoC for the workflow classes, the CoC class won't trigger.
    I even tried to CoC the table update method table.update(), and also, it did not trigger.
     
    I'm actually totally unable to CoC the update happening through the workflow.
     
    The workflow is in model 1 and I'm trying to CoC through model 2 that is referencing model 1.
  • Waed Ayyad Profile Picture
    9,190 Super User 2026 Season 1 on at
    Hi,
     
    1- Do you mean that you added the COC, and no change has happened?
     
    2- Did you try to debug the code? If no, try to debug it and see if the code is being hit when you try to complete it (You should attach Batch process when you debug the code.
     
    3- Can you share more details/ code in order to help you?
     
     
    Thanks
    Waed Ayyad
     
     
     
     
     
  • Waed Ayyad Profile Picture
    9,190 Super User 2026 Season 1 on at
    Hi,
     
    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks,
    Waed Ayyad

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Subra Profile Picture

Subra 500

#2
André Arnaud de Calavon Profile Picture

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

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 461 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans