Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to add eventHandler in tables's field?

Posted on by 920

I have table that contains user, roles, dateStart , EndDate.

When the  endDate < date of today  =>  I want to add an eventHandler that deletes role from the user .

Or I can use the modified method of field?

*This post is locked for comments

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add eventHandler in tables's field?

    Yes, just google Dynamics AX create batch job.

    For the role you need to find what is the table for user's roles. It's something like SysSecUserRole. Then delete the ones you want.

    You can find tables in AX very easily by looking at data sources of forms.

    If you have more questions in these topics, please do some web search, then start a new discussion if something is unclear.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: How to add eventHandler in tables's field?

    Thanks for reply Nikolaos Mäenpää ,

    Have you any example to create batch job ?

    How to delete user role?

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to add eventHandler in tables's field?

    I assume you want to remove the roles when the specified end date is today. You can't use event handler since nothing changes in the table when the today's date changes. So no event is triggered.

    Instead you need to develop a batch job that you set up to run daily, read your table (records where endDate is today or earlier), and then remove user's roles.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: How to add eventHandler in tables's field?

    do you need to delete record from same table from which record is being modified? or deletion wil happen in another table.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans